Skip to content

Commit 7843e72

Browse files
authored
JIT: Avoid useless EG(exception) check in ASSIGN_DIM_OP (#14247)
1 parent be4d705 commit 7843e72

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13013,7 +13013,9 @@ static int zend_jit_assign_dim_op(zend_jit_ctx *jit,
1301313013

1301413014
ZEND_ASSERT(opline->result_type == IS_UNUSED);
1301513015

13016-
jit_SET_EX_OPLINE(jit, opline);
13016+
if (may_throw) {
13017+
jit_SET_EX_OPLINE(jit, opline);
13018+
}
1301713019

1301813020
op1_addr = zend_jit_prepare_array_update(jit, opline, op1_info, op1_addr, &if_type, &ht_ref, &may_throw);
1301913021

ext/opcache/jit/zend_jit_trace.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3966,6 +3966,33 @@ static bool zend_jit_trace_must_store_type(const zend_op_array *op_array,
39663966
return 1;
39673967
}
39683968

3969+
static bool zend_jit_trace_may_throw(const zend_op *opline,
3970+
const zend_ssa_op *ssa_op,
3971+
const zend_op_array *op_array,
3972+
const zend_ssa *ssa,
3973+
uint32_t t1,
3974+
uint32_t t2,
3975+
uint32_t t3,
3976+
uint32_t val_type)
3977+
{
3978+
switch (opline->opcode) {
3979+
case ZEND_ASSIGN_DIM_OP:
3980+
if (opline->extended_value != ZEND_CONCAT
3981+
&& val_type == IS_LONG
3982+
&& (t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_ARRAY
3983+
&& MAY_BE_PACKED_ONLY(t1)
3984+
&& !(t1 & MAY_BE_ARRAY_OF_REF)
3985+
&& (t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_LONG
3986+
&& (t3 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_LONG) {
3987+
return 0;
3988+
}
3989+
break;
3990+
default:
3991+
break;
3992+
}
3993+
return zend_may_throw_ex(opline, ssa_op, op_array, ssa, t1, t2);
3994+
}
3995+
39693996
static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t parent_trace, uint32_t exit_num)
39703997
{
39713998
const void *handler = NULL;
@@ -4644,7 +4671,8 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
46444671
op2_info, (opline->op2_type != IS_UNUSED) ? OP2_REG_ADDR() : 0,
46454672
(opline->op2_type != IS_UNUSED) ? OP2_RANGE() : NULL,
46464673
op1_data_info, OP1_DATA_REG_ADDR(), OP1_DATA_RANGE(), val_type,
4647-
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info))) {
4674+
zend_jit_trace_may_throw(opline, ssa_op, op_array, ssa,
4675+
op1_info, op2_info, op1_data_info, val_type))) {
46484676
goto jit_failure;
46494677
}
46504678
goto done;

0 commit comments

Comments
 (0)