Re: com php-src: Implement argument unpacking: Zend/tests/arg_unpack/basic.phpt Zend/tests/arg_unpack/by_ref.phpt Zend/tests/arg_unpack/dynamic.phpt
Zend/tests/arg_unpack/internal.phpt Zend/tests/arg_unpack/invalid_type.phpt Zend/tests/arg_unpack/method.phpt Zend/tests/arg_unpack/new.phpt
Zend/tests/arg_unpack/string_keys.phpt Zend/tests/arg_unpack/traversable_throwing_exception.phpt
Zend/tests/arg_unpack/traversable_with_by_ref_parameters.phpt Zend/
| From: | Dmitry Stogov | Date: | Mon, 13 Jan 2014 08:56:31 +0000 |
| Subject: | Re: com php-src: Implement argument unpacking: Zend/tests/arg_unpack/basic.phpt Zend/tests/arg_unpack/by_ref.phpt Zend/tests/arg_unpack/dynamic.phpt Zend/tests/arg_unpack/internal.phpt Zend/tests/arg_unpack/invalid_type.phpt Zend/tests/arg_unpack/method.phpt Zend/tests/arg_unpack/new.phpt Zend/tests/arg_unpack/string_keys.phpt Zend/tests/arg_unpack/traversable_throwing_exception.phpt Zend/tests/arg_unpack/traversable_with_by_ref_parameters.phpt Zend/ |
||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-75580@lists.php.net to get a copy of this message | ||
Hi Nikita,
It seems like your patch is not compatible with opcache.
At least the following new tests crash with opcache enabled (-d
opcache.enable=1 -d opcache.enable_cli=1 -d opcache.optimization_level=-1).
It must be something related to optimization pass 4 -
ext/opcache/Optimizer/optimize_func_calls.c
Basic argument unpacking [Zend/tests/arg_unpack/basic.phpt]
Argument unpacking with by-ref arguments [Zend/tests/arg_unpack/by_ref.phpt]
Only arrays and Traversables can be unpacked
[Zend/tests/arg_unpack/invalid_type.phpt]
Argument unpacking does not work with string keys (forward compatibility
for named args) [Zend/tests/arg_unpack/string_keys.phpt]
Traversables that throw exceptions are properly handled during argument
unpack [Zend/tests/arg_unpack/traversable_throwing_exception.phpt]
Traversables cannot be unpacked into by-reference parameters
[Zend/tests/arg_unpack/traversable_with_by_ref_parameters.phpt]
I took just a quick look over the patch and think that it may has another
problem.
PHP compiler calculates the necessary argument stack and then VM allocates
it at once together with execeute_data.
The "argument unpacking" doesn't allow this. The patch tries to extend
stack at run-time, but it may work improperly.
For example when we are at stack boundary and execute something like
test(...array(1,2), 3, 4);
ZEND_VM_STACK_GROW_IF_NEEDED() won't extend stack because compiler
preallocated space for "3" and "4", and it'll lead to pushing above stack
boundary.
Nikita, I very appreciate your work and mostly very glad with its quality.
But as you often work on the very core parts, could you, please, ping me
before committing such serious changes.
Thanks. Dmitry.
On Sat, Jan 11, 2014 at 3:42 PM, Nikita Popov <nikic@php.net> wrote:
> Commit: 2c47dfbaebb203ab547f3c7e786cb1db5e84674a
> Author: Nikita Popov <nikic@php.net> Thu, 29 Aug 2013 11:35:11
> +0200
> Parents: c7bb28333804403c1e7cd817386ea1d527ad25e6
> Branches: PHP-5.6 master
>
> Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=2c47dfbaebb203ab547f3c7e786cb1db5e84674a
>
> Log:
> Implement argument unpacking
>
> RFC: https://wiki.php.net/rfc/argument_unpacking
>
> Changed paths:
> A Zend/tests/arg_unpack/basic.phpt
> A Zend/tests/arg_unpack/by_ref.phpt
> A Zend/tests/arg_unpack/dynamic.phpt
> A Zend/tests/arg_unpack/internal.phpt
> A Zend/tests/arg_unpack/invalid_type.phpt
> A Zend/tests/arg_unpack/method.phpt
> A Zend/tests/arg_unpack/new.phpt
> A Zend/tests/arg_unpack/string_keys.phpt
> A Zend/tests/arg_unpack/traversable_throwing_exception.phpt
> A Zend/tests/arg_unpack/traversable_with_by_ref_parameters.phpt
> M Zend/zend_compile.c
> M Zend/zend_compile.h
> M Zend/zend_execute.c
> M Zend/zend_language_parser.y
> M Zend/zend_vm_def.h
> M Zend/zend_vm_execute.h
> M Zend/zend_vm_opcodes.c
> M Zend/zend_vm_opcodes.h
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>