From 09041151de1543b69e74a6a9637455b463700a24 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 3 Jul 2019 20:19:56 +0300 Subject: [PATCH] Better optimization in RELEASE build. ZEND_ASSERT(s) prevented optimization --- Zend/zend_execute.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 5c61ad8158..6d95b7f91d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -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; -- 2.40.0