summaryrefslogtreecommitdiff
path: root/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-10-01 17:34:44 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2015-10-20 11:15:50 +0200
commitb21542b9cee7ecf2f261c9eb9286b7c61087105a (patch)
tree623a3901e3cd9414ad9ea875e2e13227a3635709 /test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
parentc99e53e8a05fc5d45f8e8a28da68d3977be65bfa (diff)
downloadscala-b21542b9cee7ecf2f261c9eb9286b7c61087105a.tar.gz
scala-b21542b9cee7ecf2f261c9eb9286b7c61087105a.tar.bz2
scala-b21542b9cee7ecf2f261c9eb9286b7c61087105a.zip
Don't create inline requests for callsites that cannot be inlined
When traversing the call graph and collecting inline reqeusts, rule out callsites that we already know cannot be inlined. Note that we cannot perform all necessary checks already at this stage: checks that depend on the callee body (the inlined code) are deferred until the callsite is actually inlined. The reason is that the code may change. Example: @inline final def f = try 1 catch { case _: Throwable => 2 } @inline final def g = f def t = println(g) When collecting inline requests, the body of g invokes the public method f, so g could be inlined into t. However, once f is inlined into g, the body of g contains a try-catch block. Now we cannot inline g into t anymore, because the call stack at the g callsite is non-empty (the stack is cleared when entering a handler).
Diffstat (limited to 'test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala')
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
index f9a55bb26e..e57e95bac4 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
@@ -16,8 +16,8 @@ object DefaultMethodTest extends ClearAfterClass.Clearable {
}
class DefaultMethodTest extends ClearAfterClass {
- ClearAfterClass.stateToClear = DirectCompileTest
- val compiler = DirectCompileTest.compiler
+ ClearAfterClass.stateToClear = DefaultMethodTest
+ val compiler = DefaultMethodTest.compiler
@Test
def defaultMethodsViaGenBCode(): Unit = {