Skip to content

Commit 0eb68eb

Browse files
committed
JIT: Fix incorrect deoptimization info
Fixes third recently introduced failure in "Nightly" "master_COMMUNUTY_asan" job
1 parent 273c2de commit 0eb68eb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5545,7 +5545,6 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
55455545
/* unconditional branch */
55465546
exit_addr = NULL;
55475547
} else if (opline->result_type == IS_TMP_VAR) {
5548-
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
55495548
uint32_t old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
55505549

55515550
SET_STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var), IS_UNKNOWN, 1);
@@ -5817,14 +5816,19 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
58175816
bool exit_if_true = 0;
58185817
const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true);
58195818
uint32_t exit_point;
5819+
int32_t old_ref = 0;
5820+
uint8_t old_flags = 0;
58205821

58215822
if (ra) {
5823+
if (opline->op2_type != IS_CONST) {
5824+
old_ref = STACK_REF(stack, EX_VAR_TO_NUM(opline->op2.var));
5825+
old_flags = STACK_FLAGS(stack, EX_VAR_TO_NUM(opline->op2.var));
5826+
}
58225827
zend_jit_trace_cleanup_stack(&ctx, stack, opline, ssa_op, ssa, ssa_opcodes);
58235828
}
58245829
if (ssa_op->op1_use >= 0
58255830
&& ssa->var_info[ssa_op->op1_use].avoid_refcounting) {
58265831
/* Temporary reset ZREG_ZVAL_TRY_ADDREF */
5827-
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
58285832
uint32_t old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->op1.var));
58295833

58305834
SET_STACK_REG(stack, EX_VAR_TO_NUM(opline->op1.var), ZREG_NONE);
@@ -5837,6 +5841,9 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
58375841
if (!exit_addr) {
58385842
goto jit_failure;
58395843
}
5844+
if (old_ref) {
5845+
SET_STACK_REF_EX(stack, EX_VAR_TO_NUM(opline->op2.var), old_ref, old_flags);
5846+
}
58405847
smart_branch_opcode = exit_if_true ? ZEND_JMPNZ : ZEND_JMPZ;
58415848
} else {
58425849
smart_branch_opcode = 0;

0 commit comments

Comments
 (0)