com php-src: Fix JMPZ, JMPZNZ_EX chain optimization: ext/opcache/Optimizer/block_pass.c
| From: | Nikita Popov | Date: | Wed, 04 May 2016 22:00:56 +0000 |
| Subject: | com php-src: Fix JMPZ, JMPZNZ_EX chain optimization: ext/opcache/Optimizer/block_pass.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92023@lists.php.net to get a copy of this message | ||
Commit: 0691e7a8e15ace3ce186ceb8c27753325a5a956f
Author: Nikita Popov <nikic@php.net> Wed, 4 May 2016 23:52:42 +0200
Parents: 9af0c96af4ded5ac0935e6cc1a2fa253ce77dfac
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0691e7a8e15ace3ce186ceb8c27753325a5a956f
Log:
Fix JMPZ, JMPZNZ_EX chain optimization
The result_type was not copied, resulting in a corrupted JMPZ_EX.
Fix can be verified by inspecting the opcodes of the following
function (it should not contain any _EX opcodes):
function test() {
if ($a && $b) {
echo "a";
}
if ($b || $c || $d) {
echo "b";
}
}
Conflicts:
ext/opcache/Optimizer/block_pass.c
Changed paths:
M ext/opcache/Optimizer/block_pass.c
Diff:
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index e168457..5e9b20d 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -1471,9 +1471,9 @@ next_target:
same_var == VAR_NUM_EX(target->op1) &&
target_block->follow_to &&
!target_block->protected) {
- /* JMPZ(X, L), L: X = JMPNZ_EX(X, L2) -> JMPZ(X, L+1) */
+ /* JMPZ(X, L), L: T = JMPNZ_EX(X, L2) -> T = JMPZ_EX(X, L+1) */
last_op->opcode += 3;
- last_op->result = target->result;
+ COPY_NODE(last_op->result, target->result);
del_source(block, block->op2_to);
block->op2_to = target_block->follow_to;
ADD_SOURCE(block, block->op2_to);