Re: com php-src: Added optimization constraint (don't optimize result of NEW, because constructor may throw exception):
ext/opcache/Optimizer/dfa_pass.c

From: Date: Fri, 22 Jan 2016 15:08:04 +0000
Subject: Re: com php-src: Added optimization constraint (don't optimize result of NEW, because constructor may throw exception):
ext/opcache/Optimizer/dfa_pass.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90732@lists.php.net to get a copy of this message
On Fri, Jan 22, 2016 at 11:30 AM, Dmitry Stogov <dmitry@php.net> wrote: > Commit: 79071fe227cdd64799c1b0aa31425b85a503a42f > Author: Dmitry Stogov <dmitry@zend.com> Fri, 22 Jan 2016 > 13:30:34 +0300 > Parents: 0df9b514799aeafdae2b5d1a8aac7ccb9ca31dd4 > Branches: master > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=79071fe227cdd64799c1b0aa31425b85a503a42f¾£ù²,´ ‹»´=Â > « > > Log: > Added optimization constraint (don't optimize result of NEW, because > constructor may throw exception) > > Changed paths: > M ext/opcache/Optimizer/dfa_pass.c > > > Diff: > diff --git a/ext/opcache/Optimizer/dfa_pass.c > b/ext/opcache/Optimizer/dfa_pass.c > index 02dfdd5..7c71e53 100644 > --- a/ext/opcache/Optimizer/dfa_pass.c > +++ b/ext/opcache/Optimizer/dfa_pass.c > @@ -155,6 +155,8 @@ void zend_dfa_optimize_op_array(zend_op_array > *op_array, zend_optimizer_ctx *ctx > && > ssa->ops[op2].op2_use_chain < 0 > && > !ssa->vars[var1].phi_use_chain > && > !ssa->vars[var1].sym_use_chain > + /* see > Zend/tests/generators/aborted_yield_during_new.phpt */ > + && > op_array->opcodes[ssa->vars[var1].definition].opcode != ZEND_NEW > ) { > int op1 = > ssa->vars[var1].definition; > int var3 = i; > I haven't tested it, but another case that's probably affected is foreach ($a as $x => $x['b']). Here normally $x['b'] is assigned first, so uses the old $x value, while afterwards $x is assigned first. A more robust check would be to make sure that the assign directly follows the instruction defining the temporary. Nikita

« previous php.cvs (#90732) next »