]> granicus.if.org Git - php/commitdiff
Avoid register allocation for ASSIGN into aliased variable (it might be indirectly...
authorDmitry Stogov <dmitry@zend.com>
Thu, 22 Oct 2020 15:22:36 +0000 (18:22 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 22 Oct 2020 15:22:36 +0000 (18:22 +0300)
ext/opcache/jit/zend_jit_trace.c

index 6e2015f158c1f0dba9749bd0a2b0600f204ad336..b0be73895ca0f82597b1291e5546a3953373339c 100644 (file)
@@ -2211,6 +2211,15 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace
 
                        support_opline =
                                zend_jit_opline_supports_reg(op_array, ssa, opline, ssa_op, p);
+
+                       if (support_opline
+                        && opline->opcode == ZEND_ASSIGN
+                        && opline->op1_type == IS_CV
+                        && zend_jit_var_may_alias(op_array, op_array_ssa, EX_VAR_TO_NUM(opline->op1.var)) != NO_ALIAS) {
+                               /* avoid register allocation in case of possiblity of indirect modification*/
+                               support_opline = 0;
+                       }
+
                        if (ssa_op->op1_use >= 0
                         && start[ssa_op->op1_use] >= 0
                         && !zend_ssa_is_no_val_use(opline, ssa_op, ssa_op->op1_use)) {