]> granicus.if.org Git - php/commitdiff
Better optimization in RELEASE build. ZEND_ASSERT(s) prevented optimization
authorDmitry Stogov <dmitry@zend.com>
Wed, 3 Jul 2019 17:19:56 +0000 (20:19 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 3 Jul 2019 17:19:56 +0000 (20:19 +0300)
Zend/zend_execute.c

index 5c61ad81585de9bc71a4b921c36b39891c3a0ecd..6d95b7f91dd82c1280cee0580c88ff9de2ae25c5 100644 (file)
@@ -406,11 +406,11 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(uint32_t var EXECUTE_D
 static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
 {
        if (op_type & (IS_TMP_VAR|IS_VAR)) {
-               if (op_type == IS_TMP_VAR) {
-                       return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
-               } else {
-                       ZEND_ASSERT(op_type == IS_VAR);
+               if (!ZEND_DEBUG || op_type == IS_VAR) {
                        return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+               } else {
+                       ZEND_ASSERT(op_type == IS_TMP_VAR);
+                       return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
                }
        } else {
                *should_free = NULL;
@@ -427,11 +427,11 @@ static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_f
 static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op node, zend_free_op *should_free EXECUTE_DATA_DC OPLINE_DC)
 {
        if (op_type & (IS_TMP_VAR|IS_VAR)) {
-               if (op_type == IS_TMP_VAR) {
-                       return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
-               } else {
-                       ZEND_ASSERT(op_type == IS_VAR);
+               if (!ZEND_DEBUG || op_type == IS_VAR) {
                        return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+               } else {
+                       ZEND_ASSERT(op_type == IS_TMP_VAR);
+                       return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
                }
        } else {
                *should_free = NULL;
@@ -490,11 +490,11 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_dere
 static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
 {
        if (op_type & (IS_TMP_VAR|IS_VAR)) {
-               if (op_type == IS_TMP_VAR) {
-                       return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
-               } else {
-                       ZEND_ASSERT(op_type == IS_VAR);
+               if (!ZEND_DEBUG || op_type == IS_VAR) {
                        return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+               } else {
+                       ZEND_ASSERT(op_type == IS_TMP_VAR);
+                       return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
                }
        } else {
                *should_free = NULL;