Skip to content

Commit bd8e0a9

Browse files
committed
Eliminate useless EG(exception) checks aftr FE_RESET/FE_FETCH
1 parent f7fbc63 commit bd8e0a9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4331,6 +4331,8 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
43314331
if (t2 & MAY_BE_UNDEF) {
43324332
switch (opline->opcode) {
43334333
case ZEND_ASSIGN_REF:
4334+
case ZEND_FE_FETCH_R:
4335+
case ZEND_FE_FETCH_RW:
43344336
break;
43354337
default:
43364338
/* undefined variable warning */
@@ -4342,6 +4344,8 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
43424344
&& (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) {
43434345
switch (opline->opcode) {
43444346
case ZEND_ASSIGN:
4347+
case ZEND_FE_FETCH_R:
4348+
case ZEND_FE_FETCH_RW:
43454349
break;
43464350
default:
43474351
/* destructor may be called */
@@ -4611,6 +4615,22 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
46114615
return 1;
46124616
}
46134617
return 0;
4618+
case ZEND_FE_RESET_R:
4619+
case ZEND_FE_RESET_RW:
4620+
if ((t1 & (MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_ARRAY) {
4621+
return 1;
4622+
}
4623+
return 0;
4624+
case ZEND_FE_FETCH_R:
4625+
if ((t1 & (MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_ARRAY) {
4626+
return 1;
4627+
}
4628+
if (opline->op2_type == IS_CV
4629+
&& (t2 & MAY_BE_RC1)
4630+
&& (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) {
4631+
return 1;
4632+
}
4633+
return 0;
46144634
default:
46154635
return 1;
46164636
}

0 commit comments

Comments
 (0)