]> granicus.if.org Git - php/commitdiff
Fixed register allocation for CASE instruction. CASE don't destroy first operand...
authorDmitry Stogov <dmitry@zend.com>
Tue, 18 Aug 2020 18:10:34 +0000 (21:10 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 18 Aug 2020 18:10:34 +0000 (21:10 +0300)
ext/opcache/jit/zend_jit_trace.c
ext/opcache/jit/zend_jit_x86.dasc

index b2541d0346986f8b5c5224943a5372ddd3eec02c..b331b895270e504872e46127dfea4f5390fc50e0 100644 (file)
@@ -2105,6 +2105,10 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace
                         && !zend_ssa_is_no_val_use(opline, ssa_op, ssa_op->op1_use)) {
                                if (support_opline) {
                                        zend_jit_trace_use_var(idx, ssa_op->op1_use, ssa_op->op1_def, ssa_op->op1_use_chain, start, end, flags, ssa, ssa_opcodes, op_array, op_array_ssa);
+                                       if (opline->opcode == ZEND_CASE && opline->op1_type != IS_CV) {
+                                               /* The value may be used outside of the trace */
+                                               flags[ssa_op->op1_use] |= ZREG_STORE;
+                                       }
                                } else {
                                        start[ssa_op->op1_use] = -1;
                                        end[ssa_op->op1_use] = -1;
index b92783c109631a5012ed09d304b96b1dd10e398d..cdae709b31862bf03a39150a32d3c88aab760add 100644 (file)
@@ -10676,6 +10676,9 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, cons
                        if (!(res_info & AVOID_REFCOUNTING)) {
                                |       TRY_ADDREF res_info, ch, r2
                        }
+                       if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
+                               return 0;
+                       }
                } else if (op1_info & MAY_BE_ARRAY_OF_REF) {
                        |       // ZVAL_COPY_DEREF
                        |       GET_ZVAL_TYPE_INFO Rd(ZREG_R2), val_addr