]> granicus.if.org Git - php/commitdiff
Avoid run-time checks performed at compile-time.
authorDmitry Stogov <dmitry@zend.com>
Tue, 13 Jun 2017 10:48:58 +0000 (13:48 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 13 Jun 2017 10:48:58 +0000 (13:48 +0300)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index dc00f3ce121b4ca81e1a0ffd699cc53d466885b6..7b390939bce7b73c9774bd801132646bc74be9a6 100644 (file)
@@ -6520,7 +6520,8 @@ ZEND_VM_C_LABEL(isset_str_offset):
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (OP2_TYPE != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                ZEND_VM_C_GOTO(isset_str_offset);
index b34082a2f74e14479e97ab95d1a2cde66c3a05ab..35bf0d3eae38b97b948813d20d5a9aa5f9b0eacd 100644 (file)
@@ -6180,7 +6180,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (IS_CONST != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -10055,7 +10056,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (IS_CV != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -11989,7 +11991,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || ((IS_TMP_VAR|IS_VAR) != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -38401,7 +38404,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (IS_CONST != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -44735,7 +44739,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (IS_CV != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -48285,7 +48290,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || ((IS_TMP_VAR|IS_VAR) != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -50327,7 +50333,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (IS_CONST != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -52522,7 +52529,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || (IS_CV != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;
@@ -53817,7 +53825,8 @@ isset_str_offset:
                                ZVAL_DEREF(offset);
                        }
                        if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
-                                       || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+                                       || ((IS_TMP_VAR|IS_VAR) != IS_CONST
+                                               && Z_TYPE_P(offset) == IS_STRING /* or numeric string */
                                                && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
                                lval = zval_get_long(offset);
                                goto isset_str_offset;