Skip to content

Commit 0904115

Browse files
committed
Better optimization in RELEASE build. ZEND_ASSERT(s) prevented optimization
1 parent 8724909 commit 0904115

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Zend/zend_execute.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,11 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(uint32_t var EXECUTE_D
406406
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)
407407
{
408408
if (op_type & (IS_TMP_VAR|IS_VAR)) {
409-
if (op_type == IS_TMP_VAR) {
410-
return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
411-
} else {
412-
ZEND_ASSERT(op_type == IS_VAR);
409+
if (!ZEND_DEBUG || op_type == IS_VAR) {
413410
return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
411+
} else {
412+
ZEND_ASSERT(op_type == IS_TMP_VAR);
413+
return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
414414
}
415415
} else {
416416
*should_free = NULL;
@@ -427,11 +427,11 @@ static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_f
427427
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)
428428
{
429429
if (op_type & (IS_TMP_VAR|IS_VAR)) {
430-
if (op_type == IS_TMP_VAR) {
431-
return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
432-
} else {
433-
ZEND_ASSERT(op_type == IS_VAR);
430+
if (!ZEND_DEBUG || op_type == IS_VAR) {
434431
return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
432+
} else {
433+
ZEND_ASSERT(op_type == IS_TMP_VAR);
434+
return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
435435
}
436436
} else {
437437
*should_free = NULL;
@@ -490,11 +490,11 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_dere
490490
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)
491491
{
492492
if (op_type & (IS_TMP_VAR|IS_VAR)) {
493-
if (op_type == IS_TMP_VAR) {
494-
return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
495-
} else {
496-
ZEND_ASSERT(op_type == IS_VAR);
493+
if (!ZEND_DEBUG || op_type == IS_VAR) {
497494
return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
495+
} else {
496+
ZEND_ASSERT(op_type == IS_TMP_VAR);
497+
return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
498498
}
499499
} else {
500500
*should_free = NULL;

0 commit comments

Comments
 (0)