Skip to content

Commit f2d8488

Browse files
committed
Fixed register allocation for CASE instruction. CASE don't destroy first operand and it may be used later in VM or different trace.
1 parent bf9ef51 commit f2d8488

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,10 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace
21052105
&& !zend_ssa_is_no_val_use(opline, ssa_op, ssa_op->op1_use)) {
21062106
if (support_opline) {
21072107
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);
2108+
if (opline->opcode == ZEND_CASE && opline->op1_type != IS_CV) {
2109+
/* The value may be used outside of the trace */
2110+
flags[ssa_op->op1_use] |= ZREG_STORE;
2111+
}
21082112
} else {
21092113
start[ssa_op->op1_use] = -1;
21102114
end[ssa_op->op1_use] = -1;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10676,6 +10676,9 @@ static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, cons
1067610676
if (!(res_info & AVOID_REFCOUNTING)) {
1067710677
| TRY_ADDREF res_info, ch, r2
1067810678
}
10679+
if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
10680+
return 0;
10681+
}
1067910682
} else if (op1_info & MAY_BE_ARRAY_OF_REF) {
1068010683
| // ZVAL_COPY_DEREF
1068110684
| GET_ZVAL_TYPE_INFO Rd(ZREG_R2), val_addr

0 commit comments

Comments
 (0)