From 1683c95e159006d40a8458d29ef266ca741752c7 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 25 Jul 2013 12:58:56 -0700 Subject: SI-7622 Clean Up Phase Assembly Let optimiser components and continuations plugin opt-out when required flags are not set. Wasted time on a whitespace error in check file, so let --debug dump the processed check file and its diff. --- test/files/run/inline-ex-handlers.scala | 4 ++-- test/files/run/programmatic-main.check | 9 ++------- test/files/run/t5313.scala | 6 +++--- test/files/run/t6102.check | 2 ++ test/files/run/t6102.flags | 2 +- test/files/run/t6288b-jump-position.scala | 9 +++------ test/files/run/t6955.check | 1 - test/files/run/t6955.scala | 12 +++++++++--- test/files/run/t6956.check | 1 - test/files/run/t6956.scala | 13 +++++++++---- test/files/run/test-cpp.scala | 4 ++-- 11 files changed, 33 insertions(+), 30 deletions(-) delete mode 100644 test/files/run/t6955.check delete mode 100644 test/files/run/t6956.check (limited to 'test/files/run') diff --git a/test/files/run/inline-ex-handlers.scala b/test/files/run/inline-ex-handlers.scala index 33e794b940..964594d258 100644 --- a/test/files/run/inline-ex-handlers.scala +++ b/test/files/run/inline-ex-handlers.scala @@ -1,6 +1,6 @@ -import scala.tools.partest.IcodeTest +import scala.tools.partest.IcodeComparison -object Test extends IcodeTest { +object Test extends IcodeComparison { override def printIcodeAfterPhase = "inlinehandlers" } diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index cc325cafc0..a6e53fbe92 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -22,11 +22,6 @@ superaccessors 6 add super accessors in traits and nested classes mixin 20 mixin composition cleanup 21 platform-specific cleanups, generate reflective calls icode 22 generate portable intermediate code - inliner 23 optimization: do inlining -inlinehandlers 24 optimization: inline exception handlers - closelim 25 optimization: eliminate uncalled closures - constopt 26 optimization: optimize null and other constants - dce 27 optimization: eliminate dead code - jvm 28 generate JVM bytecode - terminal 29 the last phase during a compilation run + jvm 23 generate JVM bytecode + terminal 24 the last phase during a compilation run diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala index febfd9c3ed..4cbc29ba5d 100644 --- a/test/files/run/t5313.scala +++ b/test/files/run/t5313.scala @@ -1,6 +1,6 @@ -import scala.tools.partest.IcodeTest +import scala.tools.partest.IcodeComparison -object Test extends IcodeTest { +object Test extends IcodeComparison { override def printIcodeAfterPhase = "dce" override def extraSettings: String = super.extraSettings + " -optimize" @@ -48,7 +48,7 @@ object Test extends IcodeTest { override def show() { val storeLocal = "STORE_LOCAL" - val lines1 = collectIcode("") filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal))) + val lines1 = collectIcode() filter (_ contains storeLocal) map (x => x.drop(x.indexOf(storeLocal))) println(lines1 mkString "\n") } } diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check index 97e455647b..4e8efa7b6d 100644 --- a/test/files/run/t6102.check +++ b/test/files/run/t6102.check @@ -20,10 +20,12 @@ [running phase mixin on t6102.scala] [running phase cleanup on t6102.scala] [running phase icode on t6102.scala] +#partest -optimise [running phase inliner on t6102.scala] [running phase inlinehandlers on t6102.scala] [running phase closelim on t6102.scala] [running phase constopt on t6102.scala] +#partest [running phase dce on t6102.scala] [running phase jvm on icode] hello diff --git a/test/files/run/t6102.flags b/test/files/run/t6102.flags index 72fe7b1aa0..726e2a997f 100644 --- a/test/files/run/t6102.flags +++ b/test/files/run/t6102.flags @@ -1 +1 @@ - -Ydead-code -Ydebug -Xfatal-warnings +-Ydead-code -Ydebug -Xfatal-warnings diff --git a/test/files/run/t6288b-jump-position.scala b/test/files/run/t6288b-jump-position.scala index e22a1ab120..c5f3bbe788 100644 --- a/test/files/run/t6288b-jump-position.scala +++ b/test/files/run/t6288b-jump-position.scala @@ -1,6 +1,6 @@ -import scala.tools.partest.IcodeTest +import scala.tools.partest.IcodeComparison -object Test extends IcodeTest { +object Test extends IcodeComparison { override def code = """object Case3 { // 01 | def unapply(z: Any): Option[Int] = Some(-1) // 02 @@ -15,8 +15,5 @@ object Test extends IcodeTest { | } |}""".stripMargin - override def show() { - val lines1 = collectIcode("") - println(lines1 mkString "\n") - } + override def show() = showIcode() } diff --git a/test/files/run/t6955.check b/test/files/run/t6955.check deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/files/run/t6955.check +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/files/run/t6955.scala b/test/files/run/t6955.scala index 980aa420cc..329af688e4 100644 --- a/test/files/run/t6955.scala +++ b/test/files/run/t6955.scala @@ -1,4 +1,4 @@ -import scala.tools.partest.IcodeTest +import scala.tools.partest.IcodeComparison // this class should compile to code that uses switches (twice) class Switches { @@ -20,9 +20,15 @@ class Switches { } } -object Test extends IcodeTest { +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() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size) + override def show() = { + val expected = 2 + val actual = (collectIcode() filter { + x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1 + }).size + assert(actual == expected) + } } diff --git a/test/files/run/t6956.check b/test/files/run/t6956.check deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/files/run/t6956.check +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/files/run/t6956.scala b/test/files/run/t6956.scala index 4a6583ca45..3569adf483 100644 --- a/test/files/run/t6956.scala +++ b/test/files/run/t6956.scala @@ -1,4 +1,4 @@ -import scala.tools.partest.IcodeTest +import scala.tools.partest.IcodeComparison class Switches { private[this] final val ONE = 1 @@ -18,9 +18,14 @@ class Switches { } } -object Test extends IcodeTest { +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() = println(collectIcode("").filter(x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1).size) + override def show() = { + val expected = 2 + val actual = (collectIcode() filter { + x => x.indexOf("SWITCH ...") >= 0 && x.indexOf("CONSTANT(") == -1 + }).size + assert(actual == expected) + } } - diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index f9fa85c4d0..c6eda56776 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -12,9 +12,9 @@ * instead of 'l'. */ -import scala.tools.partest.IcodeTest +import scala.tools.partest.IcodeComparison -object Test extends IcodeTest { +object Test extends IcodeComparison { override def printIcodeAfterPhase = "dce" } -- cgit v1.2.3