summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-09-01 18:56:47 +0300
committerDmitry Stogov <dmitry@zend.com>2020-09-01 18:56:47 +0300
commitbd8e0a96a57e4d2d409c2b8c5270e2b38d8c255a (patch)
treeedada3e27ddcff473fa8ddca61728a1c1f0142ea
parentf7fbc6333ff9a91ffb2f636790657c927b4e3c55 (diff)
downloadphp-git-bd8e0a96a57e4d2d409c2b8c5270e2b38d8c255a.tar.gz
Eliminate useless EG(exception) checks aftr FE_RESET/FE_FETCH
-rw-r--r--ext/opcache/Optimizer/zend_inference.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 5b5759abec..13e8f5d094 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -4331,6 +4331,8 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
if (t2 & MAY_BE_UNDEF) {
switch (opline->opcode) {
case ZEND_ASSIGN_REF:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
break;
default:
/* undefined variable warning */
@@ -4342,6 +4344,8 @@ int zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const ze
&& (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) {
switch (opline->opcode) {
case ZEND_ASSIGN:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
break;
default:
/* 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
return 1;
}
return 0;
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ if ((t1 & (MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_ARRAY) {
+ return 1;
+ }
+ return 0;
+ case ZEND_FE_FETCH_R:
+ if ((t1 & (MAY_BE_ANY|MAY_BE_REF)) != MAY_BE_ARRAY) {
+ return 1;
+ }
+ if (opline->op2_type == IS_CV
+ && (t2 & MAY_BE_RC1)
+ && (t2 & (MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE|MAY_BE_ARRAY_OF_ARRAY))) {
+ return 1;
+ }
+ return 0;
default:
return 1;
}