diff options
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 11 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_ssa.c | 18 |
2 files changed, 14 insertions, 15 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 36bad724f8..33bab0e7c5 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -2022,7 +2022,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{ uint32_t __type = (_type); \ int __var = (_var); \ if (__type & MAY_BE_REF) { \ - __type |= MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; \ + __type |= MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; \ } \ if (__var >= 0) { \ if (ssa_vars[__var].var < op_array->last_var) { \ @@ -2527,8 +2527,7 @@ static void zend_update_type_info(const zend_op_array *op_array, (tmp & (MAY_BE_ARRAY|MAY_BE_OBJECT))) { tmp |= MAY_BE_RC1 | MAY_BE_RCN; } else if (opline->extended_value == IS_STRING && - (t1 & MAY_BE_STRING) && - (opline->op1_type == IS_CV)) { + (t1 & MAY_BE_STRING)) { tmp |= MAY_BE_RC1 | MAY_BE_RCN; } else { tmp |= MAY_BE_RC1; @@ -2783,7 +2782,7 @@ static void zend_update_type_info(const zend_op_array *op_array, if (t1 & MAY_BE_STRING) { tmp |= MAY_BE_STRING; } - if (t1 & (MAY_BE_ANY - MAY_BE_STRING)) { + if (t1 & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_STRING)) { tmp |= (OP1_DATA_INFO() & (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF)); if (opline->op2_type == IS_UNUSED) { @@ -2796,7 +2795,7 @@ static void zend_update_type_info(const zend_op_array *op_array, tmp |= MAY_BE_NULL; } if (t1 & (MAY_BE_ANY - (MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY))) { - /* null and false are implicitly converted to array, anything else + /* undef, null and false are implicitly converted to array, anything else * results in a null return value. */ tmp |= MAY_BE_NULL; } @@ -2948,7 +2947,7 @@ static void zend_update_type_info(const zend_op_array *op_array, case ZEND_YIELD: if (ssa_ops[i].op1_def >= 0) { if (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) { - tmp = t1 & MAY_BE_REF; + tmp = t1 | MAY_BE_REF; } else { tmp = t1 & ~(MAY_BE_RC1|MAY_BE_RCN); if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) { diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index 936079396c..a0a2df92de 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -590,33 +590,33 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags, } switch (opline->opcode) { case ZEND_ASSIGN: - if (opline->op1_type == IS_CV) { - ssa_ops[k].op1_def = ssa_vars_count; - var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count; - ssa_vars_count++; - //NEW_SSA_VAR(opline->op1.var) - } if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op2_type == IS_CV) { ssa_ops[k].op2_def = ssa_vars_count; var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count; ssa_vars_count++; //NEW_SSA_VAR(opline->op2.var) } - break; - case ZEND_ASSIGN_REF: -//TODO: ??? if (opline->op1_type == IS_CV) { ssa_ops[k].op1_def = ssa_vars_count; var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count; ssa_vars_count++; //NEW_SSA_VAR(opline->op1.var) } + break; + case ZEND_ASSIGN_REF: +//TODO: ??? if (opline->op2_type == IS_CV) { ssa_ops[k].op2_def = ssa_vars_count; var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count; ssa_vars_count++; //NEW_SSA_VAR(opline->op2.var) } + if (opline->op1_type == IS_CV) { + ssa_ops[k].op1_def = ssa_vars_count; + var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count; + ssa_vars_count++; + //NEW_SSA_VAR(opline->op1.var) + } break; case ZEND_BIND_GLOBAL: case ZEND_BIND_STATIC: |