JIT: Fix incorrect deoptimization info

Fixes third recently introduced failure in "Nightly" "master_COMMUNUTY_asan" job
This commit is contained in:
Dmitry Stogov 2024-05-15 14:22:20 +03:00
parent 273c2de6a7
commit 0eb68eb8d8
No known key found for this signature in database

View file

@ -5545,7 +5545,6 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
/* unconditional branch */
exit_addr = NULL;
} else if (opline->result_type == IS_TMP_VAR) {
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
uint32_t old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->result.var));
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
bool exit_if_true = 0;
const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true);
uint32_t exit_point;
int32_t old_ref = 0;
uint8_t old_flags = 0;
if (ra) {
if (opline->op2_type != IS_CONST) {
old_ref = STACK_REF(stack, EX_VAR_TO_NUM(opline->op2.var));
old_flags = STACK_FLAGS(stack, EX_VAR_TO_NUM(opline->op2.var));
}
zend_jit_trace_cleanup_stack(&ctx, stack, opline, ssa_op, ssa, ssa_opcodes);
}
if (ssa_op->op1_use >= 0
&& ssa->var_info[ssa_op->op1_use].avoid_refcounting) {
/* Temporary reset ZREG_ZVAL_TRY_ADDREF */
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
uint32_t old_info = STACK_INFO(stack, EX_VAR_TO_NUM(opline->op1.var));
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
if (!exit_addr) {
goto jit_failure;
}
if (old_ref) {
SET_STACK_REF_EX(stack, EX_VAR_TO_NUM(opline->op2.var), old_ref, old_flags);
}
smart_branch_opcode = exit_if_true ? ZEND_JMPNZ : ZEND_JMPZ;
} else {
smart_branch_opcode = 0;