]> granicus.if.org Git - php/commitdiff
Eliminate useless EG(exception) checks aftr FE_RESET/FE_FETCH
authorDmitry Stogov <dmitry@zend.com>
Tue, 1 Sep 2020 15:56:47 +0000 (18:56 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 1 Sep 2020 15:56:47 +0000 (18:56 +0300)
ext/opcache/Optimizer/zend_inference.c

index 5b5759abec019fbe46973b0930253a76efdfed55..13e8f5d09490b33c900c5f491932c5f593296211 100644 (file)
@@ -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;
        }