diff options
Diffstat (limited to 'test/files/jvm')
23 files changed, 0 insertions, 249 deletions
diff --git a/test/files/jvm/bytecode-test-example/Foo_1.flags b/test/files/jvm/bytecode-test-example/Foo_1.flags deleted file mode 100644 index 49f2d2c4c8..0000000000 --- a/test/files/jvm/bytecode-test-example/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenASM diff --git a/test/files/jvm/constant-optimization/Foo_1.flags b/test/files/jvm/constant-optimization/Foo_1.flags deleted file mode 100644 index 67a1dbe8da..0000000000 --- a/test/files/jvm/constant-optimization/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Ynooptimise -Yconst-opt -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/jvm/constant-optimization/Foo_1.scala b/test/files/jvm/constant-optimization/Foo_1.scala deleted file mode 100644 index cb67ad4e90..0000000000 --- a/test/files/jvm/constant-optimization/Foo_1.scala +++ /dev/null @@ -1,9 +0,0 @@ -class Foo_1 { - def foo() { - // constant optimization should eliminate all branches - val i = 1 - val x = if (i != 1) null else "good" - val y = if (x == null) "good" else x + "" - println(y) - } -}
\ No newline at end of file diff --git a/test/files/jvm/constant-optimization/Test.scala b/test/files/jvm/constant-optimization/Test.scala deleted file mode 100644 index dc0f8f6103..0000000000 --- a/test/files/jvm/constant-optimization/Test.scala +++ /dev/null @@ -1,27 +0,0 @@ - -import scala.tools.partest.BytecodeTest -import scala.tools.asm -import asm.tree.InsnList -import scala.collection.JavaConverters._ - -object Test extends BytecodeTest { - val comparisons = Set(asm.Opcodes.IF_ACMPEQ, asm.Opcodes.IF_ACMPNE, asm.Opcodes.IF_ICMPEQ, asm.Opcodes.IF_ICMPGE, asm.Opcodes.IF_ICMPGT, asm.Opcodes.IF_ICMPLE, - asm.Opcodes.IF_ICMPLT, asm.Opcodes.IF_ICMPNE, asm.Opcodes.IFEQ, asm.Opcodes.IFGE, asm.Opcodes.IFGT, asm.Opcodes.IFLE, asm.Opcodes.IFLT, - asm.Opcodes.IFNE, asm.Opcodes.IFNONNULL, asm.Opcodes.IFNULL) - - def show: Unit = { - val classNode = loadClassNode("Foo_1") - val methodNode = getMethod(classNode, "foo") - // after optimization there should be no comparisons left - val expected = 0 - - val got = countComparisons(methodNode.instructions) - assert(got == expected, s"expected $expected but got $got comparisons") - } - - def countComparisons(insnList: InsnList): Int = { - def isComparison(node: asm.tree.AbstractInsnNode): Boolean = - (comparisons contains node.getOpcode) - insnList.iterator.asScala count isComparison - } -}
\ No newline at end of file diff --git a/test/files/jvm/nooptimise/Foo_1.flags b/test/files/jvm/nooptimise/Foo_1.flags deleted file mode 100644 index f493cf9f3f..0000000000 --- a/test/files/jvm/nooptimise/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --Ybackend:GenASM -optimise -Ynooptimise
\ No newline at end of file diff --git a/test/files/jvm/nooptimise/Foo_1.scala b/test/files/jvm/nooptimise/Foo_1.scala deleted file mode 100644 index 896d5695de..0000000000 --- a/test/files/jvm/nooptimise/Foo_1.scala +++ /dev/null @@ -1,8 +0,0 @@ -class Foo_1 { - def foo() { - // optimization will remove this magic 3 from appearing in the source - // so -Ynooptimize should prevent that - val x = 3 - - } -} diff --git a/test/files/jvm/nooptimise/Test.scala b/test/files/jvm/nooptimise/Test.scala deleted file mode 100644 index 7b7ecd6dbd..0000000000 --- a/test/files/jvm/nooptimise/Test.scala +++ /dev/null @@ -1,23 +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") - // if optimization didn't run then - // there should be some useless instructions - // with the magic constant 3 - val expected = 1 - val got = countMagicThrees(methodNode.instructions) - assert(got == expected, s"expected $expected but got $got magic threes") - } - - def countMagicThrees(insnList: InsnList): Int = { - def isMagicThree(node: asm.tree.AbstractInsnNode): Boolean = - (node.getOpcode == asm.Opcodes.ICONST_3) - insnList.iterator.asScala.count(isMagicThree) - } -} diff --git a/test/files/jvm/patmat_opt_ignore_underscore.check b/test/files/jvm/patmat_opt_ignore_underscore.check deleted file mode 100644 index 43f53aba12..0000000000 --- a/test/files/jvm/patmat_opt_ignore_underscore.check +++ /dev/null @@ -1 +0,0 @@ -bytecode identical diff --git a/test/files/jvm/patmat_opt_ignore_underscore.flags b/test/files/jvm/patmat_opt_ignore_underscore.flags deleted file mode 100644 index 2cd4b38726..0000000000 --- a/test/files/jvm/patmat_opt_ignore_underscore.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala b/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala deleted file mode 100644 index b0506018f6..0000000000 --- a/test/files/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/files/jvm/patmat_opt_ignore_underscore/test.scala b/test/files/jvm/patmat_opt_ignore_underscore/test.scala deleted file mode 100644 index d6630e80a0..0000000000 --- a/test/files/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/files/jvm/patmat_opt_no_nullcheck.check b/test/files/jvm/patmat_opt_no_nullcheck.check deleted file mode 100644 index 43f53aba12..0000000000 --- a/test/files/jvm/patmat_opt_no_nullcheck.check +++ /dev/null @@ -1 +0,0 @@ -bytecode identical diff --git a/test/files/jvm/patmat_opt_no_nullcheck.flags b/test/files/jvm/patmat_opt_no_nullcheck.flags deleted file mode 100644 index 2cd4b38726..0000000000 --- a/test/files/jvm/patmat_opt_no_nullcheck.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM
\ No newline at end of file diff --git a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala b/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala deleted file mode 100644 index 1e4d564cdf..0000000000 --- a/test/files/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/files/jvm/patmat_opt_no_nullcheck/test.scala b/test/files/jvm/patmat_opt_no_nullcheck/test.scala deleted file mode 100644 index d02c929e01..0000000000 --- a/test/files/jvm/patmat_opt_no_nullcheck/test.scala +++ /dev/null @@ -1,11 +0,0 @@ -/* - * filter: inliner warning; re-run with - */ -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/files/jvm/patmat_opt_primitive_typetest.check b/test/files/jvm/patmat_opt_primitive_typetest.check deleted file mode 100644 index 43f53aba12..0000000000 --- a/test/files/jvm/patmat_opt_primitive_typetest.check +++ /dev/null @@ -1 +0,0 @@ -bytecode identical diff --git a/test/files/jvm/patmat_opt_primitive_typetest.flags b/test/files/jvm/patmat_opt_primitive_typetest.flags deleted file mode 100644 index b9bb09167e..0000000000 --- a/test/files/jvm/patmat_opt_primitive_typetest.flags +++ /dev/null @@ -1 +0,0 @@ --optimize -Ybackend:GenASM diff --git a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala b/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala deleted file mode 100644 index c961082fa7..0000000000 --- a/test/files/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/files/jvm/patmat_opt_primitive_typetest/test.scala b/test/files/jvm/patmat_opt_primitive_typetest/test.scala deleted file mode 100644 index 2927e763d5..0000000000 --- a/test/files/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/files/jvm/t7006.check b/test/files/jvm/t7006.check deleted file mode 100644 index 6294b14d62..0000000000 --- a/test/files/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/files/jvm/t7006/Foo_1.flags b/test/files/jvm/t7006/Foo_1.flags deleted file mode 100644 index 29a9d424f0..0000000000 --- a/test/files/jvm/t7006/Foo_1.flags +++ /dev/null @@ -1 +0,0 @@ --optimise -Ydebug -Xfatal-warnings -Ybackend:GenASM diff --git a/test/files/jvm/t7006/Foo_1.scala b/test/files/jvm/t7006/Foo_1.scala deleted file mode 100644 index 3985557d9f..0000000000 --- a/test/files/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/files/jvm/t7006/Test.scala b/test/files/jvm/t7006/Test.scala deleted file mode 100644 index 065a23510e..0000000000 --- a/test/files/jvm/t7006/Test.scala +++ /dev/null @@ -1,19 +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") - assert(count(methodNode.instructions, asm.Opcodes.NOP) == 0) - assert(count(methodNode.instructions, asm.Opcodes.GOTO) == 1) - } - - def count(insnList: InsnList, opcode: Int): Int = { - def isNop(node: asm.tree.AbstractInsnNode): Boolean = - (node.getOpcode == opcode) - insnList.iterator.asScala.count(isNop) - } -} |