Skip to content

Commit

Permalink
Fixed register allocation for CASE instruction. CASE don't destroy fi…
Browse files Browse the repository at this point in the history
…rst operand and it may be used later in VM or different trace.
  • Loading branch information
dstogov committed Aug 18, 2020
1 parent bf9ef51 commit f2d8488
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f2d8488

Please sign in to comment.