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: Date: Tue, 14 Jan 2014 14:37:37 +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 2 3 4 5 6  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75620@lists.php.net to get a copy of this message
On Tue, Jan 14, 2014 at 7:51 PM, Dmitry Stogov <dmitry@zend.com> wrote: > Commit it. done https://github.com/php/php-src/commit/a5ee337156027e06966586984eff15e19efbf3cd thanks > > Thanks. Dmitry. > > > On Tue, Jan 14, 2014 at 3:36 PM, Laruence <laruence@php.net> wrote: >> >> On Tue, Jan 14, 2014 at 2:16 AM, Dmitry Stogov <dmitry@zend.com> wrote: >> > On Mon, Jan 13, 2014 at 9:11 PM, Nikita Popov <nikita.ppv@gmail.com> >> > wrote: >> > >> >> On Mon, Jan 13, 2014 at 9:56 AM, Dmitry Stogov <dmitry@zend.com> wrote: >> >> >> >>> 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] >> >>> >> >> >> >> Thanks for the notice, I probably used wrong ini options when trying >> >> opcache. I think the fix is to add the following lines into the >> >> optimize_func_calls switch: >> >> >> >> #if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO >> >> case ZEND_SEND_UNPACK: >> >> call_stack[call - 1].func = NULL; >> >> call_stack[call - 1].opline = NULL; >> >> break; >> >> #endif >> >> >> > >> > Thanks. Xinchen, could you please verify the patch. >> Hey: >> I confirmed, the patch works... now the tests passes. >> >> An useable patch is: >> >> $ git diff >> diff --git a/ext/opcache/Optimizer/optimize_func_calls.c >> b/ext/opcache/Optimizer/optimize_func_calls.c >> index 98bfc1e..9861930 100644 >> --- a/ext/opcache/Optimizer/optimize_func_calls.c >> +++ b/ext/opcache/Optimizer/optimize_func_calls.c >> @@ -126,7 +126,12 @@ static void optimize_func_calls(zend_op_array >> *op_array, zend_persistent_script >> call_stack[call - 1].opline = NULL; >> } >> break; >> - >> +#if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO >> + case ZEND_SEND_UNPACK: >> + call_stack[call - 1].func = NULL; >> + call_stack[call - 1].opline = NULL; >> + break; >> +#endif >> default: >> break; >> } >> >> thanks >> > >> > >> >> >> >> But I can't test this right now as opcache always segfaults during >> >> accel_shutdown (something with interned strings). I'll have to figure >> >> that >> >> out first. >> >> >> > >> > Interesting. It seems to work fine for me. May be related to some of my >> > last "fixes" :) >> > >> > >> >> >> >> >> >>> 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. >> >>> >> >> >> >> Hmm, that's a very good point. This looks not so easy to fix. I'll try >> >> to >> >> find some solution and alternatively forbid trailing fixed arguments. >> >> >> > >> > yes :( >> > and this is the problem. >> > >> > >> >> >> >> >> >>> 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. >> >>> >> >> >> >> Yes, sure! Sorry for not pinging you this time. >> >> >> > >> > Thanks for understanding. I don't have time to follow @internal >> > discussions... >> > >> > Dmitry. >> > >> > >> >> >> >> Nikita >> >> >> >> >> >> -- >> Laruence Xinchen Hui >> http://www.laruence.com/ > > -- Laruence Xinchen Hui http://www.laruence.com/

« previous php.cvs (#75620) next »