Re: Remove useless opcode handlers

From: Date: Mon, 14 Mar 2016 11:58:25 +0000
Subject: Re: Remove useless opcode handlers
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-91653@lists.php.net to get a copy of this message
On 03/14/2016 02:29 PM, Nikita Popov wrote:
On Mon, Mar 14, 2016 at 11:56 AM, Dmitry Stogov <dmitry@zend.com <mailto:dmitry@zend.com>> wrote:
    Please take a quick look and let me know if you see any problems.
    https://gist.github.com/dstogov/23cc318dd3e411904e10
    I'm going to commit this tomorrow.
    Thanks. Dmitry.
ZEND_ADD is not commutative for array operands.
Unfortunately, you are right :(
ZEND_MUL may not be commutative if operator overloading is involved (e.g. matrix multiplication is not abelian).
Right again.
The NO_CONST_CONST cases are problematic: Opcache currently, in my eyes incorrectly, evaluates constant expressions even if they throw notices (currently I think mostly by suppressing them). If we do not evaluate these, we may end up with CONST_CONST operations. (This is not a huge problem just now because constant folding in opcache is limited -- however with full constant propagation this leads to many test failures.)
The patch adds NO_CONST_CONST handling to opcache. All tests are passed, I also didn't see any problems running ~10 real-life apps.
The opcodes affected by the last point (limited to those included in your patch) are SUB, MUL, POW, CONCAT (array operands) and BW_NOT (various). However with Andrea's invalid numeric string RFC more will fall in this category (evaluable but throwing).
I didn't get what is wrong with SUB, MUL, etc, because they are evaluated at compile-time Anyway, I see - the patch can't be committed in current state. Thanks for review. Dmitry.
Nikita


« previous php.internals (#91653) next »