summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-02-02 09:27:21 -0800
committerJames Iry <jamesiry@gmail.com>2013-02-02 09:27:21 -0800
commitc7d489e21f234bf1a2ea04c6b68990c53b5b387d (patch)
treede844a62558f42e1778ffe4a9f5d1918f4fd1c02 /test/files/run
parent9b4fa8382fe0ed6fef3ff91e2c153a1840c954b9 (diff)
downloadscala-c7d489e21f234bf1a2ea04c6b68990c53b5b387d.tar.gz
scala-c7d489e21f234bf1a2ea04c6b68990c53b5b387d.tar.bz2
scala-c7d489e21f234bf1a2ea04c6b68990c53b5b387d.zip
SI-5313 Test clobbers on the back edge of a loop
I realized I was missing a test case for a local store early in a loop that was unused but turned out to be a clobber of a store later in the loop.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t5313.check2
-rw-r--r--test/files/run/t5313.scala10
2 files changed, 10 insertions, 2 deletions
diff --git a/test/files/run/t5313.check b/test/files/run/t5313.check
index aa30c0efa5..7a48b2b711 100644
--- a/test/files/run/t5313.check
+++ b/test/files/run/t5313.check
@@ -8,3 +8,5 @@ STORE_LOCAL(variable kept4)
STORE_LOCAL(variable kept4)
STORE_LOCAL(variable kept5)
STORE_LOCAL(variable kept5)
+STORE_LOCAL(variable kept6)
+STORE_LOCAL(variable kept6)
diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala
index 64009e29af..7da8726a1f 100644
--- a/test/files/run/t5313.scala
+++ b/test/files/run/t5313.scala
@@ -7,7 +7,7 @@ object Test extends IcodeTest {
override def code =
"""class Foo {
- def foo = true
+ def randomBoolean = util.Random.nextInt % 2 == 0
def bar = {
var kept1 = new Object
val result = new java.lang.ref.WeakReference(kept1)
@@ -19,7 +19,7 @@ object Test extends IcodeTest {
var erased4 = erased2 // and this
val erased5 = erased4 // and this
var kept2: Object = new Object // ultimately can't be eliminated
- while(foo) {
+ while(randomBoolean) {
val kept3 = kept2
kept2 = null // this can't, because it clobbers kept2, which is used
erased4 = null // safe to eliminate
@@ -36,6 +36,12 @@ object Test extends IcodeTest {
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
+ while(randomBoolean) {
+ var kept6: AnyRef = null // not used, but have to keep because it clobbers the next used store
+ // on the back edge of the loop
+ kept6 = new Object // used
+ println(kept6)
+ }
result
}
}""".stripMargin