diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-12-19 11:53:59 +0100 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2017-01-27 09:29:13 -0800 |
commit | 27c10db549e6f43571663d0162b58fc04fbb34bf (patch) | |
tree | 855edd6dbdae7b4b44abacf39c7e59dc95378a5b /test/files/run/bcodeInlinerMixed | |
parent | b9d4089d19ead36d07c2d6cdda283c9b678d515e (diff) | |
download | scala-27c10db549e6f43571663d0162b58fc04fbb34bf.tar.gz scala-27c10db549e6f43571663d0162b58fc04fbb34bf.tar.bz2 scala-27c10db549e6f43571663d0162b58fc04fbb34bf.zip |
adjust to partest 1.1.0's new mixed Java/Scala compilation
upgrades partest from 1.0.17 to 1.1.0
https://github.com/scala/scala-partest/pull/69
changed the mode for mixed compilation, which used to be
1. scalac *.java *.scala -d o
2. javac *.java -d o -cp o
3. scalac *.scala -d o -cp o
Now the third step is skipped. This required some adjustments to existing
tests.
- t7014 is split in two groups, the fix is for separate compilation.
- t7582 is also split. It tests inliner warnings when inling code that accesses
Java-defined package-private code. Inlining from Java only works in separate
compilation (no bytecode available in mixed compilation).
- Java compiler warnings of "run" tests were not reported in the old scheme,
now they are. Deprecation / unchecked warnings were removed from t6240, t8786,
varargs.
- t4788 required a .check file update to pass, which hints at a bug. I will
re-open SI-4788 and investigate later.
Diffstat (limited to 'test/files/run/bcodeInlinerMixed')
-rw-r--r-- | test/files/run/bcodeInlinerMixed/B_1.scala | 14 | ||||
-rw-r--r-- | test/files/run/bcodeInlinerMixed/Test.scala | 16 | ||||
-rw-r--r-- | test/files/run/bcodeInlinerMixed/Test_2.scala | 30 |
3 files changed, 36 insertions, 24 deletions
diff --git a/test/files/run/bcodeInlinerMixed/B_1.scala b/test/files/run/bcodeInlinerMixed/B_1.scala index 2aadeccb82..b26f2f1dd5 100644 --- a/test/files/run/bcodeInlinerMixed/B_1.scala +++ b/test/files/run/bcodeInlinerMixed/B_1.scala @@ -1,15 +1,13 @@ -// Partest does proper mixed compilation: +// Since 1.0.18, partest does mixed compilation only in two stages // 1. scalac *.scala *.java // 2. javac *.java -// 3. scalc *.scala -// -// In the second scalc round, the classfile for A_1 is on the classpath. -// Therefore the inliner has access to the bytecode of `bar`, which means -// it can verify that the invocation to `bar` can be safely inlined. // -// So both callsites of `flop` are inlined. +// Before it used to do a third stage +// 3. scalc *.scala // -// In a single mixed compilation, `flop` cannot be inlined, see JUnit InlinerTest.scala, def mixedCompilationNoInline. +// Because he inliner doesn't has access to the bytecode of `bar`, it cannot verify whether the +// invocation of `bar` can be safely copied to a differnet place, so `flop` is not inlined to `B.g` +// or `C.h`. class B { @inline final def flop = A_1.bar diff --git a/test/files/run/bcodeInlinerMixed/Test.scala b/test/files/run/bcodeInlinerMixed/Test.scala deleted file mode 100644 index c8c7a9fe2a..0000000000 --- a/test/files/run/bcodeInlinerMixed/Test.scala +++ /dev/null @@ -1,16 +0,0 @@ -import scala.tools.partest.{BytecodeTest, ASMConverters} -import ASMConverters._ - -object Test extends BytecodeTest { - def show: Unit = { - val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g")) - val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h")) - // val invocation = Invoke(INVOKESTATIC, A_1, bar, ()I, false) - for (i <- List(gIns, hIns)) { - assert(i exists { - case Invoke(_, _, "bar", "()I", _) => true - case _ => false - }, i mkString "\n") - } - } -} diff --git a/test/files/run/bcodeInlinerMixed/Test_2.scala b/test/files/run/bcodeInlinerMixed/Test_2.scala new file mode 100644 index 0000000000..db1ea14a8f --- /dev/null +++ b/test/files/run/bcodeInlinerMixed/Test_2.scala @@ -0,0 +1,30 @@ +import scala.tools.partest.{BytecodeTest, ASMConverters} +import ASMConverters._ + +class D { + // This is compiled with `A_1.class` on the classpath. When inlining `flop` (which invokes + // `A_1.bar`), the inliner can check that the call to `A_1.bar` can be safely inlined into a + // different classfile (D). See also comment in B_1.scala. + def m(b: B) = b.flop +} + +object Test extends BytecodeTest { + def show: Unit = { + val gIns = instructionsFromMethod(getMethod(loadClassNode("B"), "g")) + val hIns = instructionsFromMethod(getMethod(loadClassNode("C"), "h")) + for (i <- List(gIns, hIns)) { + assert(i exists { + // `flop` is not inlined + case Invoke(_, _, "flop", "()I", _) => true + case _ => false + }, i mkString "\n") + } + + val mIns = instructionsFromMethod(getMethod(loadClassNode("D"), "m")) + assert(mIns exists { + // `flop` is inlined, we get a call to `bar` + case Invoke(_, _, "bar", "()I", _) => true + case _ => false + }, mIns mkString "\n") + } +} |