com php-src: Don't reuse SSA var in UNSET_VAR: ext/opcach e/Optimizer/zend_dfg.c ext/opcache/Optimizer/zend_infer ence.c
ext/opcache/Optimizer/zend_ssa.c

From: Date: Sat, 26 Dec 2015 22:33:58 +0000
Subject: com php-src: Don't reuse SSA var in UNSET_VAR: ext/opcach e/Optimizer/zend_dfg.c ext/opcache/Optimizer/zend_infer ence.c
ext/opcache/Optimizer/zend_ssa.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90468@lists.php.net to get a copy of this message
Commit: 33870c525a59d4a82ae679881b70c0267680b21f Author: Nikita Popov <nikic@php.net> Sat, 26 Dec 2015 23:06:56 +0100 Parents: 80a39539ca074aa331a08988c97283848cea7a38 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=33870c525a59d4a82ae679881b70c0267680b21f Log: Don't reuse SSA var in UNSET_VAR Instead use the SSA var that UNSET_VAR actually defines. Otherwise we get issues trying to DCE unsets. Changed paths: M ext/opcache/Optimizer/zend_dfg.c M ext/opcache/Optimizer/zend_inference.c M ext/opcache/Optimizer/zend_ssa.c Diff: diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c index d4fb283..7c3e80d 100644 --- a/ext/opcache/Optimizer/zend_dfg.c +++ b/ext/opcache/Optimizer/zend_dfg.c @@ -106,6 +106,9 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg } DFG_SET(gen, set_size, j, EX_VAR_TO_NUM(opline->op1.var)); break; + case ZEND_UNSET_VAR: + ZEND_ASSERT(opline->extended_value & ZEND_QUICK_SET); + /* break missing intentionally */ case ZEND_ASSIGN_ADD: case ZEND_ASSIGN_SUB: case ZEND_ASSIGN_MUL: diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 730f603..8fa9bfd 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -3299,9 +3299,13 @@ static void zend_update_type_info(const zend_op_array *op_array, } break; case ZEND_UNSET_VAR: - if (opline->extended_value & ZEND_QUICK_SET) { - UPDATE_SSA_TYPE((MAY_BE_UNDEF|MAY_BE_RCN), ssa_ops[i].op1_def); + ZEND_ASSERT(opline->extended_value & ZEND_QUICK_SET); + tmp = MAY_BE_UNDEF|MAY_BE_RCN; + if (!op_array->function_name) { + /* In global scope, we know nothing */ + tmp |= MAY_BE_REF; } + UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def); break; case ZEND_UNSET_DIM: case ZEND_UNSET_OBJ: diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index d9e8516..505c0b9 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -333,7 +333,7 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags, case ZEND_UNSET_VAR: if (opline->extended_value & ZEND_QUICK_SET) { ssa_ops[k].op1_def = ssa_vars_count; - var[EX_VAR_TO_NUM(opline->op1.var)] = EX_VAR_TO_NUM(opline->op1.var); + var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count; ssa_vars_count++; } break;

« previous php.cvs (#90468) next »