Fixed register allocation for CASE instruction. CASE don't destroy first operand and it may be used later in VM or different trace.

This commit is contained in:
Dmitry Stogov 2020-08-18 21:10:34 +03:00
parent bf9ef513c0
commit f2d8488806
2 changed files with 7 additions and 0 deletions

View 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;

View 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