diff options
author | Dmitry Stogov <dmitry@php.net> | 2008-04-11 09:43:28 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2008-04-11 09:43:28 +0000 |
commit | d9dd1b9e144749e9563c789d89297fefc173766b (patch) | |
tree | bcc74a1ca0ce1ff00036dc2755c4be73b020879f /Zend/zend_execute_API.c | |
parent | ca3391f44c0285bf2717c2ab2273745bde572889 (diff) | |
download | php-git-d9dd1b9e144749e9563c789d89297fefc173766b.tar.gz |
Optimized ZEND_RETURN opcode to not allocate and copy return value if it is not
used.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 98b17376cd..74ffc1c56c 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1273,7 +1273,7 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0'; } else { Z_STRLEN(pv) = strlen(str); - Z_STRVAL(pv) = estrndup(str, Z_STRLEN(pv)); + Z_STRVAL(pv) = str; } Z_TYPE(pv) = IS_STRING; @@ -1317,7 +1317,9 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSR } else { retval = FAILURE; } - zval_dtor(&pv); + if (retval_ptr) { + zval_dtor(&pv); + } return retval; } /* }}} */ @@ -1339,7 +1341,6 @@ void execute_new_code(TSRMLS_D) /* {{{ */ { zend_op *opline, *end; zend_op *ret_opline; - zval *local_retval=NULL; if (!(CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) || CG(active_op_array)->backpatch_count>0 @@ -1393,12 +1394,9 @@ void execute_new_code(TSRMLS_D) /* {{{ */ zend_release_labels(TSRMLS_C); - EG(return_value_ptr_ptr) = &local_retval; + EG(return_value_ptr_ptr) = NULL; EG(active_op_array) = CG(active_op_array); zend_execute(CG(active_op_array) TSRMLS_CC); - if (local_retval) { - zval_ptr_dtor(&local_retval); - } if (EG(exception)) { zend_exception_error(EG(exception) TSRMLS_CC); |