diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-05-24 22:13:20 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-05-24 22:23:00 +0200 |
commit | 1db58b52e064579e857260de93e1a706a783a7e5 (patch) | |
tree | 69933f1052954b12f44ca8f9a5b050c9cef658aa /test/junit | |
parent | 207e32df30fd733e4dd1cb28fb8cb5c3153c21a6 (diff) | |
download | scala-1db58b52e064579e857260de93e1a706a783a7e5.tar.gz scala-1db58b52e064579e857260de93e1a706a783a7e5.tar.bz2 scala-1db58b52e064579e857260de93e1a706a783a7e5.zip |
Debug flag to print a summary of the inliner's work
Example output below. Note that inlining List.map fails because the
trait forwarder uses `INVOKESPECIAL` for now, will change with pr 5177.
$ cat Test.scala
class C {
def foo = Map(1 -> 'a', 2 -> 'b')
def bar(l: List[Int]) = l.map(_ + 1)
}
$ qsc -Yopt-log-inline _ -Yopt:l:classpath Test.scala
Inlining into C.foo (initially 36 instructions, ultimately 72):
- Inlined scala/Predef$ArrowAssoc$.$minus$greater$extension (8 instructions) 2 times: the callee is annotated `@inline`
Inlining into C.bar (initially 12 instructions, ultimately 12):
- Failed to inline scala/collection/immutable/List.map (the callee is a higher-order method, the argument for parameter (bf: Function1) is a function literal): The callee scala/collection/immutable/List::map(Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; contains the instruction INVOKESPECIAL scala/collection/TraversableLike.map (Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object;
that would cause an IllegalAccessError when inlined into class C.
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index fd020c7d93..fb708c4f29 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -72,7 +72,7 @@ class InlinerTest extends BytecodeTesting { def inlineTest(code: String, mod: ClassNode => Unit = _ => ()): MethodNode = { val (gMethod, fCall) = gMethAndFCallsite(code, mod) - inliner.inline(InlineRequest(fCall, Nil)) + inliner.inline(InlineRequest(fCall, Nil, null)) gMethod } @@ -343,7 +343,7 @@ class InlinerTest extends BytecodeTesting { val warning = inliner.canInlineBody(call) assert(warning.isEmpty, warning) - inliner.inline(InlineRequest(call, Nil)) + inliner.inline(InlineRequest(call, Nil, null)) val ins = instructionsFromMethod(fMeth) // no invocations, lowestOneBit is inlined @@ -976,7 +976,7 @@ class InlinerTest extends BytecodeTesting { inliner.inline(InlineRequest(hCall, post = List(InlineRequest(gCall, - post = List(InlineRequest(fCall, Nil)))))) + post = List(InlineRequest(fCall, Nil, null)), null)), null)) assertNoInvoke(convertMethod(iMeth)) // no invoke in i: first h is inlined, then the inlined call to g is also inlined, etc for f assertInvoke(convertMethod(gMeth), "C", "f") // g itself still has the call to f } @@ -998,11 +998,11 @@ class InlinerTest extends BytecodeTesting { val bCall = getCallsite(c, "b") val cCall = getCallsite(d, "c") - inliner.inline(InlineRequest(bCall, Nil)) + inliner.inline(InlineRequest(bCall, Nil, null)) val req = InlineRequest(cCall, List(InlineRequest(bCall, - List(InlineRequest(aCall, Nil))))) + List(InlineRequest(aCall, Nil, null)), null)), null) inliner.inline(req) assertNoInvoke(convertMethod(d)) |