com php-src: Fixed SCCP on PHI(partial_object#1, pa rtial_object#2): ext/opcache/Optimizer/sccp.c e xt/opcache/tests/opt/sccp_014.phpt
| From: | Xinchen Hui | Date: | Sat, 02 Sep 2017 10:40:26 +0000 |
| Subject: | com php-src: Fixed SCCP on PHI(partial_object#1, pa rtial_object#2): ext/opcache/Optimizer/sccp.c e xt/opcache/tests/opt/sccp_014.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99232@lists.php.net to get a copy of this message | ||
Commit: 7c9556db99a63449cc4b2635a560bacb63d868c9
Author: Xinchen Hui <laruence@gmail.com> Sat, 2 Sep 2017 18:38:51 +0800
Parents: 8a7ba133c3c4e70a5b4fe8b9e9189cb3c64e71b3
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7c9556db99a63449cc4b2635a560bacb63d868c9
Log:
Fixed SCCP on PHI(partial_object#1, partial_object#2)
Bugs:
https://bugs.php.net/1
https://bugs.php.net/2
Changed paths:
M ext/opcache/Optimizer/sccp.c
A ext/opcache/tests/opt/sccp_014.phpt
Diff:
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 8065a72..991a501 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -144,16 +144,16 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) {
return;
}
- /* PARTIAL_ARRAY is lower than IS_ARRAY */
- if (Z_TYPE_P(value) == IS_ARRAY && IS_PARTIAL_ARRAY(new)) {
+ /* Always replace PARTIAL_(ARRAY|OBJECT), as new maybe changed by join_partial_(arrays|object) */
+ if (IS_PARTIAL_ARRAY(new) || IS_PARTIAL_OBJECT(new)) {
zval_ptr_dtor_nogc(value);
ZVAL_COPY(value, new);
- scdf_add_to_worklist(scdf, var);
+ /*?? scdf_add_to_worklist(scdf, var); */
return;
}
#if ZEND_DEBUG
- ZEND_ASSERT(IS_PARTIAL_ARRAY(new) || IS_PARTIAL_OBJECT(new) || zend_is_identical(value, new));
+ ZEND_ASSERT(zend_is_identical(value, new));
#endif
}
diff --git a/ext/opcache/tests/opt/sccp_014.phpt b/ext/opcache/tests/opt/sccp_014.phpt
new file mode 100644
index 0000000..0e5ccd0
--- /dev/null
+++ b/ext/opcache/tests/opt/sccp_014.phpt
@@ -0,0 +1,22 @@
+--TEST--
+SCCP 013: Conditional Constant Propagation of non-escaping object properties on PHI
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function loadEntities($entity_information) {
+ $entity_types = new StdClass();
+ $entity_types->a = 1;
+ foreach ($entity_information as $info) {
+ $entity_types->a = 0;
+ }
+ var_dump((bool)($entity_types->a));
+}
+
+loadEntities(array("first", "second"));
+--EXPECT--
+bool(false)