com php-src: Fixed SCCP rewinding on partial_array|object phi: ext/opcache/Optimizer/sccp.c ext/opcache/tests/ opt/sccp_013.phpt
ext/opcache/tests/opt/sccp_0 14.phpt ext/opcache/tests/opt/sccp_015.phpt

From: Date: Sat, 02 Sep 2017 13:28:33 +0000
Subject: com php-src: Fixed SCCP rewinding on partial_array|object phi: ext/opcache/Optimizer/sccp.c ext/opcache/tests/ opt/sccp_013.phpt
ext/opcache/tests/opt/sccp_0 14.phpt ext/opcache/tests/opt/sccp_015.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-99233@lists.php.net to get a copy of this message
Commit: 4afe5a5cb29a747af3d9b26bc36b60afd5598888 Author: Xinchen Hui <laruence@gmail.com> Sat, 2 Sep 2017 21:28:33 +0800 Parents: 7c9556db99a63449cc4b2635a560bacb63d868c9 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4afe5a5cb29a747af3d9b26bc36b60afd5598888 Log: Fixed SCCP rewinding on partial_array|object phi Changed paths: M ext/opcache/Optimizer/sccp.c M ext/opcache/tests/opt/sccp_013.phpt M ext/opcache/tests/opt/sccp_014.phpt A ext/opcache/tests/opt/sccp_015.phpt Diff: diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 991a501...a0ed22e 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -146,9 +146,12 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) { /* Always replace PARTIAL_(ARRAY|OBJECT), as new maybe changed by join_partial_(arrays|object) */ if (IS_PARTIAL_ARRAY(new) || IS_PARTIAL_OBJECT(new)) { - zval_ptr_dtor_nogc(value); - ZVAL_COPY(value, new); - /*?? scdf_add_to_worklist(scdf, var); */ + if (Z_TYPE_P(value) != Z_TYPE_P(new) + || zend_hash_num_elements(Z_ARR_P(new)) != zend_hash_num_elements(Z_ARR_P(value))) { + zval_ptr_dtor_nogc(value); + ZVAL_COPY(value, new); + scdf_add_to_worklist(scdf, var); + } return; } diff --git a/ext/opcache/tests/opt/sccp_013.phpt b/ext/opcache/tests/opt/sccp_013.phpt index 052e92f..d421743 100644 --- a/ext/opcache/tests/opt/sccp_013.phpt +++ b/ext/opcache/tests/opt/sccp_013.phpt @@ -17,5 +17,6 @@ function loadEntities($entity_information) { } loadEntities(array("first", "second")); +?> --EXPECT-- bool(true) diff --git a/ext/opcache/tests/opt/sccp_014.phpt b/ext/opcache/tests/opt/sccp_014.phpt index 0e5ccd0..ffa9dc3 100644 --- a/ext/opcache/tests/opt/sccp_014.phpt +++ b/ext/opcache/tests/opt/sccp_014.phpt @@ -18,5 +18,6 @@ function loadEntities($entity_information) { } loadEntities(array("first", "second")); +?> --EXPECT-- bool(false) diff --git a/ext/opcache/tests/opt/sccp_015.phpt b/ext/opcache/tests/opt/sccp_015.phpt new file mode 100644 index 0000000..ce53a97 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_015.phpt @@ -0,0 +1,26 @@ +--TEST-- +SCCP 013: Conditional Constant Propagation of non-escaping object properties on PHI and Rewinding +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +function loadEntities($entity_information) { + $entity_types = new StdClass(); + $entity_types->b = 0; + foreach ($entity_information as $ex) { + var_dump((bool)$entity_types->b); + foreach ($entity_information as $info) { + $entity_types->b = 1; + } + } +} + +loadEntities(array("first", "second")); +?> +--EXPECT-- +bool(false) +bool(true)

« previous php.cvs (#99233) next »