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

[email protected] (Derick Rethans)
Newsgroups php.internals,php.zend-engine.cvs
Message-ID <[email protected]>
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

-- 
Derick Rethans
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.