Skip to content

Commit

Permalink
JIT: Avoid useless EG(exception) check in ASSIGN_DIM_OP (#14247)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed May 15, 2024
1 parent be4d705 commit 7843e72
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -13013,7 +13013,9 @@ static int zend_jit_assign_dim_op(zend_jit_ctx *jit,

ZEND_ASSERT(opline->result_type == IS_UNUSED);

jit_SET_EX_OPLINE(jit, opline);
if (may_throw) {
jit_SET_EX_OPLINE(jit, opline);
}

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

Expand Down
30 changes: 29 additions & 1 deletion ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3966,6 +3966,33 @@ static bool zend_jit_trace_must_store_type(const zend_op_array *op_array,
return 1;
}

static bool zend_jit_trace_may_throw(const zend_op *opline,
const zend_ssa_op *ssa_op,
const zend_op_array *op_array,
const zend_ssa *ssa,
uint32_t t1,
uint32_t t2,
uint32_t t3,
uint32_t val_type)
{
switch (opline->opcode) {
case ZEND_ASSIGN_DIM_OP:
if (opline->extended_value != ZEND_CONCAT
&& val_type == IS_LONG
&& (t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_ARRAY
&& MAY_BE_PACKED_ONLY(t1)
&& !(t1 & MAY_BE_ARRAY_OF_REF)
&& (t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_LONG
&& (t3 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) == MAY_BE_LONG) {
return 0;
}
break;
default:
break;
}
return zend_may_throw_ex(opline, ssa_op, op_array, ssa, t1, t2);
}

static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t parent_trace, uint32_t exit_num)
{
const void *handler = NULL;
Expand Down Expand Up @@ -4644,7 +4671,8 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
op2_info, (opline->op2_type != IS_UNUSED) ? OP2_REG_ADDR() : 0,
(opline->op2_type != IS_UNUSED) ? OP2_RANGE() : NULL,
op1_data_info, OP1_DATA_REG_ADDR(), OP1_DATA_RANGE(), val_type,
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info))) {
zend_jit_trace_may_throw(opline, ssa_op, op_array, ssa,
op1_info, op2_info, op1_data_info, val_type))) {
goto jit_failure;
}
goto done;
Expand Down

0 comments on commit 7843e72

Please sign in to comment.