diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2016-01-26 06:59:23 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2016-01-26 06:59:23 +0100 |
commit | ef77a5497a64f4fa870e830e9114bd00db269452 (patch) | |
tree | 4ce0d9afde8d2c44e0920d276661b0e57ca6d6bb /test/pending | |
parent | 90ee1b871236402f8543bf424a4f38d909598b3a (diff) | |
parent | 983894f24b6c79934af757173d9e44faecd34069 (diff) | |
download | scala-ef77a5497a64f4fa870e830e9114bd00db269452.tar.gz scala-ef77a5497a64f4fa870e830e9114bd00db269452.tar.bz2 scala-ef77a5497a64f4fa870e830e9114bd00db269452.zip |
Merge pull request #4916 from lrytz/restoreASMTests
Restore backend tests that were removed together with GenASM
Diffstat (limited to 'test/pending')
26 files changed, 0 insertions, 646 deletions
diff --git a/test/pending/jvm/patmat_opt_ignore_underscore.check b/test/pending/jvm/patmat_opt_ignore_underscore.check deleted file mode 100644 index 43f53aba12..0000000000 --- a/test/pending/jvm/patmat_opt_ignore_underscore.check +++ /dev/null @@ -1 +0,0 @@ -bytecode identical diff --git a/test/pending/jvm/patmat_opt_ignore_underscore.flags b/test/pending/jvm/patmat_opt_ignore_underscore.flags deleted file mode 100644 index 453b6b7895..0000000000 --- a/test/pending/jvm/patmat_opt_ignore_underscore.flags +++ /dev/null @@ -1 +0,0 @@ --Yopt:l:project
\ No newline at end of file diff --git a/test/pending/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala b/test/pending/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala deleted file mode 100644 index b0506018f6..0000000000 --- a/test/pending/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala +++ /dev/null @@ -1,29 +0,0 @@ -// this class's bytecode, compiled under -optimize is analyzed by the test -// method a's bytecode should be identical to method b's bytecode -// this is not the best test for shielding against regressing on this particular issue, -// but it sets the stage for checking the bytecode emitted by the pattern matcher and -// comparing it to manually tuned code using if/then/else etc. -class SameBytecode { - case class Foo(x: Any, y: String) - - def a = - Foo(1, "a") match { - case Foo(_: String, y) => y - } - - // this method's body holds the tree that should be generated by the pattern matcher for method a (-Xprint:patmat) - // the test checks that bytecode for a and b is identical (modulo line numbers) - // we can't diff trees as they are quite different (patmat uses jumps to labels that cannot be expressed in source, for example) - // note that the actual tree is quite bad: we do an unnecessary null check, isInstanceOf and local val (x3) - // some of these will be fixed soon (the initial null check is for the scrutinee, which is harder to fix in patmat) - def b: String = { - val x1 = Foo(1, "a") - if (x1.ne(null)) { - if (x1.x.isInstanceOf[String]) { - return x1.y - } - } - - throw new MatchError(x1) - } -}
\ No newline at end of file diff --git a/test/pending/jvm/patmat_opt_ignore_underscore/test.scala b/test/pending/jvm/patmat_opt_ignore_underscore/test.scala deleted file mode 100644 index d6630e80a0..0000000000 --- a/test/pending/jvm/patmat_opt_ignore_underscore/test.scala +++ /dev/null @@ -1,18 +0,0 @@ -/* - * filter: inliner warning; re-run with - */ -import scala.tools.partest.BytecodeTest - -import scala.tools.nsc.util.JavaClassPath -import java.io.InputStream -import scala.tools.asm -import asm.ClassReader -import asm.tree.{ClassNode, InsnList} -import scala.collection.JavaConverters._ - -object Test extends BytecodeTest { - def show: Unit = { - val classNode = loadClassNode("SameBytecode") - sameBytecode(getMethod(classNode, "a"), getMethod(classNode, "b")) - } -} diff --git a/test/pending/jvm/patmat_opt_no_nullcheck.check b/test/pending/jvm/patmat_opt_no_nullcheck.check deleted file mode 100644 index 43f53aba12..0000000000 --- a/test/pending/jvm/patmat_opt_no_nullcheck.check +++ /dev/null @@ -1 +0,0 @@ -bytecode identical diff --git a/test/pending/jvm/patmat_opt_no_nullcheck.flags b/test/pending/jvm/patmat_opt_no_nullcheck.flags deleted file mode 100644 index 453b6b7895..0000000000 --- a/test/pending/jvm/patmat_opt_no_nullcheck.flags +++ /dev/null @@ -1 +0,0 @@ --Yopt:l:project
\ No newline at end of file diff --git a/test/pending/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala b/test/pending/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala deleted file mode 100644 index 1e4d564cdf..0000000000 --- a/test/pending/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala +++ /dev/null @@ -1,24 +0,0 @@ -// this class's bytecode, compiled under -optimize is analyzed by the test -// method a's bytecode should be identical to method b's bytecode -case class Foo(x: Any) - -class SameBytecode { - def a = - (Foo(1): Any) match { - case Foo(_: String) => - } - - // there's no null check - def b: Unit = { - val x1: Any = Foo(1) - if (x1.isInstanceOf[Foo]) { - val x3 = x1.asInstanceOf[Foo] - if (x3.x.isInstanceOf[String]) { - val x = () - return - } - } - - throw new MatchError(x1) - } -}
\ No newline at end of file diff --git a/test/pending/jvm/patmat_opt_no_nullcheck/test.scala b/test/pending/jvm/patmat_opt_no_nullcheck/test.scala deleted file mode 100644 index 5a4a398b67..0000000000 --- a/test/pending/jvm/patmat_opt_no_nullcheck/test.scala +++ /dev/null @@ -1,14 +0,0 @@ -/* - * filter: inliner warning; re-run with - */ -import scala.tools.partest.{ BytecodeTest, ASMConverters } - -object Test extends BytecodeTest { - def show: Unit = { - val classNode = loadClassNode("SameBytecode") - // ASM and GenBCode assign variable slots slightly differently - val instrsA = ASMConverters.instructionsFromMethod(getMethod(classNode, "a")) - val instrsB = ASMConverters.instructionsFromMethod(getMethod(classNode, "b")) - assert(ASMConverters.equivalentBytecode(instrsA, instrsB), diffInstructions(instrsA, instrsB)) // doesn't work - } -} diff --git a/test/pending/jvm/patmat_opt_primitive_typetest.check b/test/pending/jvm/patmat_opt_primitive_typetest.check deleted file mode 100644 index 43f53aba12..0000000000 --- a/test/pending/jvm/patmat_opt_primitive_typetest.check +++ /dev/null @@ -1 +0,0 @@ -bytecode identical diff --git a/test/pending/jvm/patmat_opt_primitive_typetest.flags b/test/pending/jvm/patmat_opt_primitive_typetest.flags deleted file mode 100644 index 19c578e4ad..0000000000 --- a/test/pending/jvm/patmat_opt_primitive_typetest.flags +++ /dev/null @@ -1 +0,0 @@ --Yopt:l:project diff --git a/test/pending/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala b/test/pending/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala deleted file mode 100644 index c961082fa7..0000000000 --- a/test/pending/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala +++ /dev/null @@ -1,24 +0,0 @@ -// this class's bytecode, compiled under -optimize is analyzed by the test -// method a's bytecode should be identical to method b's bytecode -class SameBytecode { - case class Foo(x: Int, y: String) - - def a = - Foo(1, "a") match { - case Foo(_: Int, y) => y - } - - // this method's body holds the tree that should be generated by the pattern matcher for method a (-Xprint:patmat) - // the test checks that bytecode for a and b is identical (modulo line numbers) - // we can't diff trees as they are quite different (patmat uses jumps to labels that cannot be expressed in source, for example) - // note that the actual tree is quite bad: we do an unnecessary null check, and local val (x3) - // some of these will be fixed soon (the initial null check is for the scrutinee, which is harder to fix in patmat) - def b: String = { - val x1 = Foo(1, "a") - if (x1.ne(null)) { - return x1.y - } - - throw new MatchError(x1) - } -}
\ No newline at end of file diff --git a/test/pending/jvm/patmat_opt_primitive_typetest/test.scala b/test/pending/jvm/patmat_opt_primitive_typetest/test.scala deleted file mode 100644 index 2927e763d5..0000000000 --- a/test/pending/jvm/patmat_opt_primitive_typetest/test.scala +++ /dev/null @@ -1,8 +0,0 @@ -import scala.tools.partest.BytecodeTest - -object Test extends BytecodeTest { - def show: Unit = { - val classNode = loadClassNode("SameBytecode") - sameBytecode(getMethod(classNode, "a"), getMethod(classNode, "b")) - } -} diff --git a/test/pending/jvm/t7006.check b/test/pending/jvm/t7006.check deleted file mode 100644 index 6294b14d62..0000000000 --- a/test/pending/jvm/t7006.check +++ /dev/null @@ -1,29 +0,0 @@ -[running phase parser on Foo_1.scala] -[running phase namer on Foo_1.scala] -[running phase packageobjects on Foo_1.scala] -[running phase typer on Foo_1.scala] -[running phase patmat on Foo_1.scala] -[running phase superaccessors on Foo_1.scala] -[running phase extmethods on Foo_1.scala] -[running phase pickler on Foo_1.scala] -[running phase refchecks on Foo_1.scala] -[running phase uncurry on Foo_1.scala] -[running phase tailcalls on Foo_1.scala] -[running phase specialize on Foo_1.scala] -[running phase explicitouter on Foo_1.scala] -[running phase erasure on Foo_1.scala] -[running phase posterasure on Foo_1.scala] -[running phase lazyvals on Foo_1.scala] -[running phase lambdalift on Foo_1.scala] -[running phase constructors on Foo_1.scala] -[running phase flatten on Foo_1.scala] -[running phase mixin on Foo_1.scala] -[running phase cleanup on Foo_1.scala] -[running phase delambdafy on Foo_1.scala] -[running phase icode on Foo_1.scala] -[running phase inliner on Foo_1.scala] -[running phase inlinehandlers on Foo_1.scala] -[running phase closelim on Foo_1.scala] -[running phase constopt on Foo_1.scala] -[running phase dce on Foo_1.scala] -[running phase jvm on icode] diff --git a/test/pending/jvm/t7006/Foo_1.flags b/test/pending/jvm/t7006/Foo_1.flags deleted file mode 100644 index 5d1b6b2644..0000000000 --- a/test/pending/jvm/t7006/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Yopt:l:project -Ydebug -Xfatal-warnings diff --git a/test/pending/jvm/t7006/Foo_1.scala b/test/pending/jvm/t7006/Foo_1.scala deleted file mode 100644 index 3985557d9f..0000000000 --- a/test/pending/jvm/t7006/Foo_1.scala +++ /dev/null @@ -1,10 +0,0 @@ -class Foo_1 { - def foo { - try { - val x = 3 // this will be optimized away, leaving a useless jump only block - } finally { - print("hello") - } - while(true){} // ensure infinite loop doesn't break the algorithm - } -} diff --git a/test/pending/jvm/t7006/Test.scala b/test/pending/jvm/t7006/Test.scala deleted file mode 100644 index 7b4a8c45fb..0000000000 --- a/test/pending/jvm/t7006/Test.scala +++ /dev/null @@ -1,21 +0,0 @@ -import scala.tools.partest.BytecodeTest -import scala.tools.asm -import asm.tree.InsnList -import scala.collection.JavaConverters._ - -object Test extends BytecodeTest { - def show: Unit = { - val classNode = loadClassNode("Foo_1") - val methodNode = getMethod(classNode, "foo") - val nopCount = count(methodNode.instructions, asm.Opcodes.NOP) - val gotoCount = count(methodNode.instructions, asm.Opcodes.GOTO) - assert(nopCount == 0, s"NOPs expected: 0, actual: $nopCount") - assert(gotoCount == 1, s"GOTOs expected: 1, actual: $gotoCount") - } - - def count(insnList: InsnList, opcode: Int): Int = { - def isNop(node: asm.tree.AbstractInsnNode): Boolean = - (node.getOpcode == opcode) - insnList.iterator.asScala.count(isNop) - } -} diff --git a/test/pending/pos/inliner2.flags b/test/pending/pos/inliner2.flags deleted file mode 100644 index 4bf93a9c2a..0000000000 --- a/test/pending/pos/inliner2.flags +++ /dev/null @@ -1,35 +0,0 @@ --optimise -Ybackend:GenASM -Xfatal-warnings -/* -This is what we get with 2.11.2-M3 and -Yopt:l:project: - - public final int bob1(); - Code: - 0: aload_0 - 1: aload_0 - 2: astore 6 - 4: aload 6 - 6: invokedynamic #62, 0 // InvokeDynamic #0:apply$mcZ$sp:(LA;)Lscala/runtime/java8/JFunction0$mcZ$sp; - 11: checkcast #29 // class scala/Function0 - 14: invokedynamic #71, 0 // InvokeDynamic #1:apply$mcI$sp:()Lscala/runtime/java8/JFunction0$mcI$sp; - 19: checkcast #29 // class scala/Function0 - 22: invokedynamic #76, 0 // InvokeDynamic #2:apply$mcI$sp:()Lscala/runtime/java8/JFunction0$mcI$sp; - 27: checkcast #29 // class scala/Function0 - 30: astore 4 - 32: astore_3 - 33: astore_2 - 34: astore_1 - 35: aload_2 - 36: pop - 37: aload 6 - 39: invokevirtual #53 // Method A$$$anonfun$1:()Z - 42: ifeq 54 - 45: aload_3 - 46: invokeinterface #36, 1 // InterfaceMethod scala/Function0.apply:()Ljava/lang/Object; - 51: goto 61 - 54: aload 4 - 56: invokeinterface #36, 1 // InterfaceMethod scala/Function0.apply:()Ljava/lang/Object; - 61: astore 5 - 63: aload 5 - 65: invokestatic #82 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I - 68: ireturn -*/
\ No newline at end of file diff --git a/test/pending/pos/inliner2.scala b/test/pending/pos/inliner2.scala deleted file mode 100644 index bc83e04312..0000000000 --- a/test/pending/pos/inliner2.scala +++ /dev/null @@ -1,57 +0,0 @@ -// This isn't actually testing much, because no warning is emitted in versions -// before the fix which comes with this because the method isn't even considered -// for inlining due to the bug. -class A { - private var debug = false - @inline private def ifelse[T](cond: => Boolean, ifPart: => T, elsePart: => T): T = - if (cond) ifPart else elsePart - - final def bob1() = ifelse(debug, 1, 2) - final def bob2() = if (debug) 1 else 2 -} -// Cool: -// -// % ls -1 /tmp/2901/ -// A$$anonfun$bob1$1.class -// A$$anonfun$bob1$2.class -// A$$anonfun$bob1$3.class -// A.class -// % ls -1 /tmp/trunk -// A.class -// -// Observations: -// -// (1) The inlined version accesses the field: the explicit one calls the accessor. -// (2) The inlined version fails to eliminate boxing. With reference types it emits -// an unneeded checkcast. -// (3) The private var debug is mangled to A$$debug, but after inlining it is never accessed -// from outside of the class and doesn't need mangling. -// (4) We could forego emitting bytecode for ifelse entirely if it has been -// inlined at all sites. -// -// Generated bytecode for the above: -// -// public final int bob1(); -// Code: -// Stack=1, Locals=1, Args_size=1 -// 0: aload_0 -// 1: getfield #11; //Field A$$debug:Z -// 4: ifeq 14 -// 7: iconst_1 -// 8: invokestatic #41; //Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; -// 11: goto 18 -// 14: iconst_2 -// 15: invokestatic #41; //Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; -// 18: invokestatic #45; //Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I -// 21: ireturn -// -// public final int bob2(); -// Code: -// Stack=1, Locals=1, Args_size=1 -// 0: aload_0 -// 1: invokevirtual #48; //Method A$$debug:()Z -// 4: ifeq 11 -// 7: iconst_1 -// 8: goto 12 -// 11: iconst_2 -// 12: ireturn diff --git a/test/pending/pos/sealed-final.flags b/test/pending/pos/sealed-final.flags deleted file mode 100644 index 63d024a0ba..0000000000 --- a/test/pending/pos/sealed-final.flags +++ /dev/null @@ -1,41 +0,0 @@ --Xfatal-warnings -Yinline-warnings -Ybackend:GenASM -optimise -/* -The new flag settings could be - -Yopt-warnings -Yopt:l:project - -The issue here is that things are being inlined, but a lot of -redundant load/store instructions are left behind: - -2.11.7: - - public int f(); - Code: - 0: getstatic #19 // Field Foo$.MODULE$:LFoo$; - 3: invokevirtual #23 // Method Foo$.mkFoo:()LFoo; - 6: pop - 7: bipush 10 - 9: iconst_1 - 10: iadd - 11: ireturn - - -2.12.0-M3: - - public int f(); - Code: - 0: getstatic #19 // Field Foo$.MODULE$:LFoo$; - 3: invokevirtual #23 // Method Foo$.mkFoo:()LFoo; - 6: bipush 10 - 8: istore_2 - 9: dup - 10: ifnonnull 15 - 13: aconst_null - 14: athrow - 15: astore_1 - 16: iload_2 - 17: iconst_1 - 18: iadd - 19: istore_3 - 20: iload_3 - 21: ireturn -*/
\ No newline at end of file diff --git a/test/pending/pos/sealed-final.scala b/test/pending/pos/sealed-final.scala deleted file mode 100644 index bdedb5c1f6..0000000000 --- a/test/pending/pos/sealed-final.scala +++ /dev/null @@ -1,14 +0,0 @@ -sealed abstract class Foo { - @inline def bar(x: Int) = x + 1 -} -object Foo { - def mkFoo(): Foo = new Baz2 -} - -object Baz1 extends Foo -final class Baz2 extends Foo - -object Test { - // bar should be inlined now - def f = Foo.mkFoo() bar 10 -} diff --git a/test/pending/run/t5313.check b/test/pending/run/t5313.check deleted file mode 100644 index 7a48b2b711..0000000000 --- a/test/pending/run/t5313.check +++ /dev/null @@ -1,12 +0,0 @@ -STORE_LOCAL(variable kept1) -STORE_LOCAL(value result) -STORE_LOCAL(variable kept1) -STORE_LOCAL(variable kept2) -STORE_LOCAL(value kept3) -STORE_LOCAL(variable kept2) -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/pending/run/t5313.scala b/test/pending/run/t5313.scala deleted file mode 100644 index 4a5b076e6e..0000000000 --- a/test/pending/run/t5313.scala +++ /dev/null @@ -1,54 +0,0 @@ -import scala.tools.partest.IcodeComparison - -object Test extends IcodeComparison { - override def printIcodeAfterPhase = "dce" - - override def extraSettings: String = super.extraSettings + " -Yopt:l:classpath" - - override def code = - """class Foo { - def randomBoolean = scala.util.Random.nextInt % 2 == 0 - def bar = { - var kept1 = new Object - val result = new java.lang.ref.WeakReference(kept1) - kept1 = null // we can't eliminate this assignment 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 - val erased5 = erased4 // and this - var kept2: Object = new Object // ultimately can't be eliminated - while(randomBoolean) { - val kept3 = kept2 - kept2 = null // this can't, because it clobbers kept2, which is used - erased4 = null // safe to eliminate - println(kept3) - } - var kept4 = new Object // have to keep, it's used - try - println(kept4) - 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 - 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 - - override def show() { - val storeLocal = "STORE_LOCAL" - val lines1 = collectIcode() filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal))) - println(lines1 mkString "\n") - } -} diff --git a/test/pending/run/t6955.scala b/test/pending/run/t6955.scala deleted file mode 100644 index 787617eff1..0000000000 --- a/test/pending/run/t6955.scala +++ /dev/null @@ -1,33 +0,0 @@ -import scala.tools.partest.IcodeComparison - -// this class should compile to code that uses switches (twice) -class Switches { - type Tag = Byte - - def switchBad(i: Tag): Int = i match { // notice type of i is Tag = Byte - case 1 => 1 - case 2 => 2 - case 3 => 3 - case _ => 0 - } - - // this worked before, should keep working - def switchOkay(i: Byte): Int = i match { - case 1 => 1 - case 2 => 2 - case 3 => 3 - case _ => 0 - } -} - -object Test extends IcodeComparison { - // ensure we get two switches out of this -- ignore the rest of the output for robustness - // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) - override def show() = { - val expected = 2 - val actual = (collectIcode() filter { - x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1 - }).size - assert(actual == expected, s"switches expected: $expected, actual: $actual") - } -} diff --git a/test/pending/run/t6956.scala b/test/pending/run/t6956.scala deleted file mode 100644 index 57d721807d..0000000000 --- a/test/pending/run/t6956.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.tools.partest.IcodeComparison - -class Switches { - private[this] final val ONE = 1 - - def switchBad(i: Byte): Int = i match { - case ONE => 1 - case 2 => 2 - case 3 => 3 - case _ => 0 - } - - def switchOkay(i: Byte): Int = i match { - case 1 => 1 - case 2 => 2 - case 3 => 3 - case _ => 0 - } -} - -object Test extends IcodeComparison { - // ensure we get two switches out of this -- ignore the rest of the output for robustness - // exclude the constant we emit for the "SWITCH ..." string below (we get the icode for all the code you see in this file) - override def show() = { - val expected = 2 - val actual = (collectIcode() filter { - x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1 - }).size - assert(actual == expected, s"switches expected: $expected, actual: $actual") - } -} diff --git a/test/pending/run/test-cpp.check b/test/pending/run/test-cpp.check deleted file mode 100644 index ff4c9bf2bf..0000000000 --- a/test/pending/run/test-cpp.check +++ /dev/null @@ -1,81 +0,0 @@ ---- a -+++ b -@@ -54,3 +54,3 @@ - def main(args: Array[String] (ARRAY[REF(class String)])): Unit { -- locals: value args, value x, value y -+ locals: value args - startBlock: 1 -@@ -59,10 +59,6 @@ - 1: -- 52 CONSTANT(2) -- 52 STORE_LOCAL(value x) - 52 SCOPE_ENTER value x -- 53 LOAD_LOCAL(value x) -- 53 STORE_LOCAL(value y) - 53 SCOPE_ENTER value y - 54 LOAD_MODULE object Predef -- 54 LOAD_LOCAL(value y) -+ 54 CONSTANT(2) - 54 BOX INT -@@ -109,3 +105,3 @@ - def main(args: Array[String] (ARRAY[REF(class String)])): Unit { -- locals: value args, value x, value y -+ locals: value args, value x - startBlock: 1 -@@ -118,7 +114,5 @@ - 81 SCOPE_ENTER value x -- 82 LOAD_LOCAL(value x) -- 82 STORE_LOCAL(value y) - 82 SCOPE_ENTER value y - 83 LOAD_MODULE object Predef -- 83 LOAD_LOCAL(value y) -+ 83 LOAD_LOCAL(value x) - 83 BOX INT -@@ -152,3 +146,3 @@ - def main(args: Array[String] (ARRAY[REF(class String)])): Unit { -- locals: value args, value x, value y -+ locals: value args - startBlock: 1 -@@ -157,10 +151,6 @@ - 1: -- 66 THIS(TestAliasChainDerefThis) -- 66 STORE_LOCAL(value x) - 66 SCOPE_ENTER value x -- 67 LOAD_LOCAL(value x) -- 67 STORE_LOCAL(value y) - 67 SCOPE_ENTER value y - 68 LOAD_MODULE object Predef -- 68 LOAD_LOCAL(value y) -+ 68 THIS(Object) - 68 CALL_METHOD scala.Predef.println (dynamic) -@@ -193,3 +183,3 @@ - def test(x: Int (INT)): Unit { -- locals: value x, value y -+ locals: value x - startBlock: 1 -@@ -198,7 +188,5 @@ - 1: -- 29 LOAD_LOCAL(value x) -- 29 STORE_LOCAL(value y) - 29 SCOPE_ENTER value y - 30 LOAD_MODULE object Predef -- 30 LOAD_LOCAL(value y) -+ 30 LOAD_LOCAL(value x) - 30 BOX INT -@@ -240,7 +228,5 @@ - 96 SCOPE_ENTER variable x -- 97 LOAD_LOCAL(variable x) -- 97 STORE_LOCAL(variable y) - 97 SCOPE_ENTER variable y - 98 LOAD_MODULE object Predef -- 98 LOAD_LOCAL(variable y) -+ 98 LOAD_LOCAL(variable x) - 98 BOX INT -@@ -250,6 +236,4 @@ - 100 STORE_LOCAL(variable y) -- 101 LOAD_LOCAL(variable y) -- 101 STORE_LOCAL(variable x) - 102 LOAD_MODULE object Predef -- 102 LOAD_LOCAL(variable x) -+ 102 LOAD_LOCAL(variable y) - 102 BOX INT diff --git a/test/pending/run/test-cpp.scala b/test/pending/run/test-cpp.scala deleted file mode 100644 index 4fca67d51e..0000000000 --- a/test/pending/run/test-cpp.scala +++ /dev/null @@ -1,104 +0,0 @@ -/** - * The only change is in the decision to replace a LOAD_LOCAL(l) - * in the copy-propagation performed before ClosureElimination. - * - * In the general case, the local variable 'l' is connected through - * an alias chain with other local variables and at the end of the - * alias chain there may be a Value, call it 'v'. - * - * If 'v' is cheaper to access (it is a Deref(This) or Const(_)), then - * replace the instruction to load it from the cheaper place. - * Otherwise, we use the local variable at the end of the alias chain - * instead of 'l'. - */ - -import scala.tools.partest.IcodeComparison - -object Test extends IcodeComparison { - override def printIcodeAfterPhase = "dce" -} - -import scala.util.Random._ - -/** - * The example in the bug report (Issue-5321): an alias chain which store - * an Unknown. Should remove local variable 'y'. - */ -object TestBugReport { - def test(x: Int) = { - val y = x - println(y) - } -} - -/** - * The code taken from scala.tools.nsc.settings.Settings: - * After inlining of the setter is performed, there is an opportunity for - * copy-propagation to eliminate some local variables. - */ -object TestSetterInline { - private var _postSetHook: this.type => Unit = (x: this.type) => () - def withPostSetHook(f: this.type => Unit): this.type = { _postSetHook = f ; this } -} - - -/** - * The access of the local variable 'y' should be replaced by the - * constant. - */ -object TestAliasChainConstant { - - def main(args: Array[String]): Unit = { - val x = 2 - val y = x - println(y) - } -} - -/** - * At the end of the alias chain we have a reference to 'this'. - * The local variables should be all discarded and replace by a - * direct reference to this - */ -class TestAliasChainDerefThis { - - def main(args: Array[String]): Unit = { - val x = this - val y = x - println(y) - } -} - -/** - * At the end of the alias chain, there is the value of a field. - * The use of variable 'y' should be replaced by 'x', not by an access - * to the field 'f' since it is more costly. - */ -object TestAliasChainDerefField { - def f = nextInt - - def main(args: Array[String]): Unit = { - val x = f - val y = x - println(y) - } -} - - -/** - * The first time 'println' is called, 'x' is replaced by 'y' - * and the second time, 'y' is replaced by 'x'. But none of them - * can be removed. - */ -object TestDifferentBindings { - - def main(args: Array[String]): Unit = { - var x = nextInt - var y = x - println(y) - - y = nextInt - x = y - println(x) - } -} |