Skip to content

Commit 8ca0ef6

Browse files
committed
Fix may_throw and indirect_reference in tracing JIT
Reuse the zend_may_throw logic instead of repeating it here. Don't set indirect_reference if container may be `false`, as this is going through the slow path now, and the container may not be in r0 anymore, which is what zend_jit_fetch_indirect_var() assumes.
1 parent ca82731 commit 8ca0ef6

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,6 +4516,7 @@ ZEND_API int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op,
45164516
case ZEND_ISSET_ISEMPTY_CV:
45174517
case ZEND_MAKE_REF:
45184518
case ZEND_FETCH_DIM_W:
4519+
case ZEND_FETCH_LIST_W:
45194520
break;
45204521
default:
45214522
/* undefined variable warning */

ext/opcache/jit/zend_jit_trace.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5196,18 +5196,15 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
51965196
op1_def_info = OP1_DEF_INFO();
51975197
if (!zend_jit_fetch_dim(&dasm_state, opline,
51985198
op1_info, op1_addr, op2_info, RES_REG_ADDR(),
5199-
(opline->opcode == ZEND_FETCH_DIM_RW
5200-
|| opline->op2_type == IS_UNUSED
5201-
|| (op1_info & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))
5202-
|| (op2_info & (MAY_BE_UNDEF|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT))
5199+
(zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info)
52035200
|| (opline->op1_type == IS_VAR
52045201
&& (op1_info & MAY_BE_UNDEF)
52055202
&& !ssa->var_info[ssa_op->op1_use].indirect_reference)))) {
52065203
goto jit_failure;
52075204
}
52085205
if (ssa_op->result_def > 0
52095206
&& (opline->opcode == ZEND_FETCH_DIM_W || opline->opcode == ZEND_FETCH_LIST_W)
5210-
&& !(op1_info & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))
5207+
&& !(op1_info & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))
52115208
&& !(op2_info & (MAY_BE_UNDEF|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT))) {
52125209
ssa->var_info[ssa_op->result_def].indirect_reference = 1;
52135210
}

0 commit comments

Comments
 (0)