summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-01-29 09:13:30 -0800
committerJames Iry <jamesiry@gmail.com>2013-01-30 09:44:42 -0800
commit9b4fa8382fe0ed6fef3ff91e2c153a1840c954b9 (patch)
treeb6e6509530957c10097f94be090d9487d388e0a8 /test/files/run
parenteab288442931f01b5bad2dcfa244a6183db0f4b6 (diff)
downloadscala-9b4fa8382fe0ed6fef3ff91e2c153a1840c954b9.tar.gz
scala-9b4fa8382fe0ed6fef3ff91e2c153a1840c954b9.tar.bz2
scala-9b4fa8382fe0ed6fef3ff91e2c153a1840c954b9.zip
SI-5313 Eliminate more stores by replacing clobbers with null stores
When an unused store clobbers a previous store, replace it with storing a null. Don't mark clobbers as "used" so that the original clobber and all following clobbers can still be eliminated.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t5313.check2
-rw-r--r--test/files/run/t5313.scala8
2 files changed, 9 insertions, 1 deletions
diff --git a/test/files/run/t5313.check b/test/files/run/t5313.check
index dd8791f109..aa30c0efa5 100644
--- a/test/files/run/t5313.check
+++ b/test/files/run/t5313.check
@@ -6,3 +6,5 @@ STORE_LOCAL(value kept3)
STORE_LOCAL(variable kept2)
STORE_LOCAL(variable kept4)
STORE_LOCAL(variable kept4)
+STORE_LOCAL(variable kept5)
+STORE_LOCAL(variable kept5)
diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala
index b65311622a..64009e29af 100644
--- a/test/files/run/t5313.scala
+++ b/test/files/run/t5313.scala
@@ -13,6 +13,7 @@ object Test extends IcodeTest {
val result = new java.lang.ref.WeakReference(kept1)
kept1 = null // we can't eliminate this assigment because result can observe
// when the object has no more references. See SI-5313
+ kept1 = new Object // but we can eliminate this one because kept1 has already been clobbered
var erased2 = null // we can eliminate this store because it's never used
val erased3 = erased2 // and this
var erased4 = erased2 // and this
@@ -20,7 +21,7 @@ object Test extends IcodeTest {
var kept2: Object = new Object // ultimately can't be eliminated
while(foo) {
val kept3 = kept2
- kept2 = null // this can't, because it clobbers x, which is ultimately used
+ kept2 = null // this can't, because it clobbers kept2, which is used
erased4 = null // safe to eliminate
println(kept3)
}
@@ -30,6 +31,11 @@ object Test extends IcodeTest {
catch {
case _ : Throwable => kept4 = null // have to keep, it clobbers kept4 which is used
}
+ var kept5 = new Object
+ print(kept5)
+ kept5 = null // can't eliminate it's a clobber and it's used
+ print(kept5)
+ kept5 = null // can eliminate because we don't care about clobbers of nulls
result
}
}""".stripMargin