com php-src: Improved fix for #71127: ext/opcache/Optimizer/pas s1_5.c ext/opcache/Optimizer/zend_optimizer.h e xt/opcache/tests/bug71127.phpt
| From: | Xinchen Hui | Date: | Fri, 18 Dec 2015 09:37:40 +0000 |
| Subject: | com php-src: Improved fix for #71127: ext/opcache/Optimizer/pas s1_5.c ext/opcache/Optimizer/zend_optimizer.h e xt/opcache/tests/bug71127.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90332@lists.php.net to get a copy of this message | ||
Commit: 40702799b5f08b093477098881b6e0cfcb3ea411
Author: Xinchen Hui <laruence@gmail.com> Fri, 18 Dec 2015 17:37:40 +0800
Parents: 940c68b55d4241f9f34d4f71064f5f12a44e8d3d
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=40702799b5f08b093477098881b6e0cfcb3ea411
Log:
Improved fix for #71127
Bugs:
https://bugs.php.net/71127
Changed paths:
M ext/opcache/Optimizer/pass1_5.c
M ext/opcache/Optimizer/zend_optimizer.h
M ext/opcache/tests/bug71127.phpt
Diff:
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index f252117..4229f13 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -16,9 +16,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
int i = 0;
zend_op *opline = op_array->opcodes;
zend_op *end = opline + op_array->last;
- /* bug #71127*
- zend_bool collect_constants = (op_array == &script->main_op_array); */
- zend_bool collect_constants = 0;
+ zend_bool collect_constants = (ZEND_OPTIMIZER_PASS_15 & OPTIMIZATION_LEVEL)?
+ (op_array == &script->main_op_array) : 0;
while (opline < end) {
switch (opline->opcode) {
diff --git a/ext/opcache/Optimizer/zend_optimizer.h b/ext/opcache/Optimizer/zend_optimizer.h
index fc6ec43..f4e4417 100644
--- a/ext/opcache/Optimizer/zend_optimizer.h
+++ b/ext/opcache/Optimizer/zend_optimizer.h
@@ -39,9 +39,10 @@
#define ZEND_OPTIMIZER_PASS_12 (1<<11)
#define ZEND_OPTIMIZER_PASS_13 (1<<12)
#define ZEND_OPTIMIZER_PASS_14 (1<<13)
+#define ZEND_OPTIMIZER_PASS_15 (1<<14) /* Collect constants */
#define ZEND_OPTIMIZER_ALL_PASSES 0xFFFFFFFF
-#define DEFAULT_OPTIMIZATION_LEVEL "0xFFFFFFFF"
+#define DEFAULT_OPTIMIZATION_LEVEL "0xFFFFBFFF"
#endif
diff --git a/ext/opcache/tests/bug71127.phpt b/ext/opcache/tests/bug71127.phpt
index 78c5535...5770aea 100644
--- a/ext/opcache/tests/bug71127.phpt
+++ b/ext/opcache/tests/bug71127.phpt
@@ -3,6 +3,7 @@ Bug #71127 (Define in auto_prepend_file is overwrite)
--INI--
opcache.enable=1
opcache.enable_cli=1
+opcache.optimization_level=0xFFFFBFFF
--SKIPIF--
<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
--FILE--