Skip to content

Commit 2068f01

Browse files
committed
Eliminate useless exception checks
1 parent 5ea28fe commit 2068f01

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4255,11 +4255,8 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array)
42554255
free_alloca(worklist, use_heap);
42564256
}
42574257

4258-
int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa)
4258+
int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, uint32_t t1, uint32_t t2)
42594259
{
4260-
uint32_t t1 = OP1_INFO();
4261-
uint32_t t2 = OP2_INFO();
4262-
42634260
if (opline->op1_type == IS_CV) {
42644261
if (t1 & MAY_BE_UNDEF) {
42654262
switch (opline->opcode) {
@@ -4594,3 +4591,8 @@ int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_
45944591
return 1;
45954592
}
45964593
}
4594+
4595+
int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa)
4596+
{
4597+
return zend_may_throw_ex(opline, ssa_op, op_array, ssa, OP1_INFO(), OP2_INFO());
4598+
}

ext/opcache/Optimizer/zend_inference.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ void zend_func_return_info(const zend_op_array *op_array,
270270
int widening,
271271
zend_ssa_var_info *ret);
272272

273+
int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa, uint32_t t1, uint32_t t2);
273274
int zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, zend_ssa *ssa);
274275

275276
int zend_update_type_info(const zend_op_array *op_array,

ext/opcache/jit/zend_jit_trace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,7 +3243,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
32433243
if (!zend_jit_assign_dim_op(&dasm_state, opline, op_array,
32443244
op1_info, op1_def_info, op1_addr, op2_info,
32453245
op1_data_info, OP1_DATA_RANGE(),
3246-
zend_may_throw(opline, ssa_op, op_array, ssa))) {
3246+
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info))) {
32473247
goto jit_failure;
32483248
}
32493249
goto done;
@@ -3267,7 +3267,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
32673267
CHECK_OP1_DATA_TRACE_TYPE();
32683268
if (!zend_jit_assign_dim(&dasm_state, opline, op_array,
32693269
op1_info, op1_addr, op2_info, op1_data_info,
3270-
zend_may_throw(opline, ssa_op, op_array, ssa))) {
3270+
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info))) {
32713271
goto jit_failure;
32723272
}
32733273
goto done;
@@ -3318,7 +3318,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
33183318
op1_def_info, op1_def_addr,
33193319
op2_info, op2_addr, op2_def_addr,
33203320
res_info, res_addr,
3321-
zend_may_throw(opline, ssa_op, op_array, ssa))) {
3321+
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info))) {
33223322
goto jit_failure;
33233323
}
33243324
goto done;
@@ -3768,7 +3768,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
37683768
}
37693769
if (!zend_jit_isset_isempty_dim(&dasm_state, opline, op_array,
37703770
op1_info, op1_addr, op2_info,
3771-
zend_may_throw(opline, ssa_op, op_array, ssa),
3771+
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, op2_info),
37723772
smart_branch_opcode, -1, -1,
37733773
exit_addr)) {
37743774
goto jit_failure;
@@ -3839,7 +3839,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
38393839
if (!zend_jit_fetch_obj(&dasm_state, opline, op_array,
38403840
op1_info, op1_addr, op1_indirect, ce, ce_is_instanceof,
38413841
delayed_fetch_this,
3842-
zend_may_throw(opline, ssa_op, op_array, ssa))) {
3842+
zend_may_throw_ex(opline, ssa_op, op_array, ssa, op1_info, MAY_BE_STRING))) {
38433843
goto jit_failure;
38443844
}
38453845
goto done;

0 commit comments

Comments
 (0)