summaryrefslogtreecommitdiff
path: root/ext/opcache/tests/opt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-09-11 16:23:17 +0300
committerDmitry Stogov <dmitry@zend.com>2017-09-11 16:23:17 +0300
commitd5c527c9db12a1e4a9d1d62c8ed933c60228ae73 (patch)
tree2159dd41a9f550920752d4ffee12fef83f0e6c3c /ext/opcache/tests/opt
parent441b826e3a66e09a7be2f153277d1d41361d2e1c (diff)
downloadphp-git-d5c527c9db12a1e4a9d1d62c8ed933c60228ae73.tar.gz
Fixed SCCP failure, because of aliased objects.
For now, mark aliased objects as "escaping". A more clever solution would requitre Heap Array SSA + Definitely Same and Definitely Different sets construction.
Diffstat (limited to 'ext/opcache/tests/opt')
-rw-r--r--ext/opcache/tests/opt/sccp_017.phpt29
-rw-r--r--ext/opcache/tests/opt/sccp_018.phpt23
2 files changed, 52 insertions, 0 deletions
diff --git a/ext/opcache/tests/opt/sccp_017.phpt b/ext/opcache/tests/opt/sccp_017.phpt
new file mode 100644
index 0000000000..4aa7f96509
--- /dev/null
+++ b/ext/opcache/tests/opt/sccp_017.phpt
@@ -0,0 +1,29 @@
+--TEST--
+SCCP 017: Array assignemnt
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.opt_debug_level=0x20000
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = [];
+ $b = $a;
+ $a[0] = 5;
+ $b[0] = 42;
+ return $a[0];
+}
+?>
+--EXPECTF--
+$_main: ; (lines=1, args=0, vars=0, tmps=0)
+ ; (after optimizer)
+ ; %ssccp_017.php:1-10
+L0: RETURN int(1)
+
+foo: ; (lines=1, args=0, vars=0, tmps=0)
+ ; (after optimizer)
+ ; %ssccp_017.php:2-8
+L0: RETURN int(5)
diff --git a/ext/opcache/tests/opt/sccp_018.phpt b/ext/opcache/tests/opt/sccp_018.phpt
new file mode 100644
index 0000000000..66a4b6ca15
--- /dev/null
+++ b/ext/opcache/tests/opt/sccp_018.phpt
@@ -0,0 +1,23 @@
+--TEST--
+SCCP 018: Object assignemnt
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+;opcache.opt_debug_level=0x20000
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = new stdClass;
+ $b = $a;
+ $a->x = 5;
+ $b->x = 42;
+ echo $a->x;
+ echo "\n";
+}
+foo();
+?>
+--EXPECT--
+42