Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend.c zend_execute_API.c zend_vm_def.h zend_vm_execute.h php-src NEWS

From: Date: Fri, 11 Apr 2008 17:43:06 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_3) / zend.c zend_execute_API.c zend_vm_def.h zend_vm_execute.h php-src NEWS
References: 1 2  Groups: php.internals php.zend-engine.cvs 
Request: Send a blank email to internals+get-36961@lists.php.net to get a copy of this message
Hi Derick, Sorry, but I think mainly about PHP performance, and of course I didn't know that you trace return_values it in xdebug. After the patch, in case if return value is not used we set EG(return_value_ptr_ptr) to NULL before call to nested execute(). I assume you can just check for (EG(return_value_ptr_ptr)==NULL) before write it. Will it work for you? Thanks. Dmitry. Derick Rethans wrote:
On Fri, 11 Apr 2008, Dmitry Stogov wrote:
dmitry Fri Apr 11 09:43:31 2008 UTC
  Modified files:              (Branch: PHP_5_3)
    /php-src	NEWS     /ZendEngine2	zend.c zend_execute_API.c zend_vm_def.h                 	zend_vm_execute.h   Log:
Optimized ZEND_RETURN opcode to not allocate and copy return value if it is not used.
Hmm, I'm not too happy with this, as it breaks some functionality in Xdebug. Xdebug allows you to create a function trace, including all return values. For example the following script: <?php function foo() { return 42; } foo(); echo foo(); ?> Gave a function trace like (with php -d xdebug.auto_trace=1 -dxdebug.collect_return=1 test-ft.php): TRACE START [2008-04-11 10:29:49]
    0.0002     650528   -> {main}() /tmp/test-ft.php:0
    0.0003     650840     -> foo() /tmp/test-ft.php:8
=> 42
    0.0004     650840     -> foo() /tmp/test-ft.php:9
=> 42 => 1
    0.0013      54536
TRACE END [2008-04-11 10:29:49] However, with this change, I only get: TRACE START [2008-04-11 10:32:11]
    0.2148     652336   -> {main}() /tmp/test-ft.php:0
    0.2907     652648     -> foo() /tmp/test-ft.php:8
    0.3178     652648     -> foo() /tmp/test-ft.php:9
=> 42
    0.4802      56344
TRACE END [2008-04-11 10:32:12] Is it still possible to get the return values of the functions that are *not* used? I currently check if EG(return_value_ptr_ptr) and *EG(return_value_ptr_ptr) are not NULL to see if there is a return value, and now (of course) they are empty (null pointer). regards, Derick


« previous php.internals (#36961) next »