summaryrefslogtreecommitdiff
path: root/test/files/neg/sealed-final-neg.check
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-11-15 15:11:58 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-11-25 11:53:43 +0100
commit8020cd66c8b30126bbba1dc1e87f7daafb3f2dd7 (patch)
tree520e397d27b0d453df664c8d9abab2fc9f80de34 /test/files/neg/sealed-final-neg.check
parenteb7d907f6283f897f6b248bae170bade57969519 (diff)
downloadscala-8020cd66c8b30126bbba1dc1e87f7daafb3f2dd7.tar.gz
scala-8020cd66c8b30126bbba1dc1e87f7daafb3f2dd7.tar.bz2
scala-8020cd66c8b30126bbba1dc1e87f7daafb3f2dd7.zip
Better inliner support for 2.12 trait encoding
Some changes to the trait encoding came late in the 2.12 cycle, and the inliner was not adapted to support it in the best possible way. In 2.12.0 concrete trait methods are encoded as interface T { default int m() { return 1 } static int m$(T $this) { <invokespecial $this.m()> } } class C implements T { public int m() { return T.m$(this) } } If a trait method is selected for inlining, the 2.12.0 inliner would copy its body into the static super accessor `T.m$`, and from there into the mixin forwarder `C.m`. This commit special-cases the inliner: - We don't inline into static super accessors and mixin forwarders. - Insted, when inlining an invocation of a mixin forwarder, the inliner also follows through the two forwarders and inlines the trait method body. There was a difficulty implementing this: inlining the static static super accessor would copy an `invokespecial` instruction into a different classfile, which is not legal / may change semantics. That `invokespecial` is supposed to disappear when inlining the actual default method body. However, this last step may fail, for example because the trait method body itself contains instructions that are not legal in a different classfile. It is very difficult to perform all necessary checks ahead of time. So instead, this commit implements the ability to speculatively inline a callsite and roll back if necessary. The commit also cleans up the implementation of inliner warnings a little. The previous code would always emit a warning when a method annotated `@inline` was not picked by the heuristics - this was a problem when the callsite in the static super accessor was no longer chosen.
Diffstat (limited to 'test/files/neg/sealed-final-neg.check')
-rw-r--r--test/files/neg/sealed-final-neg.check6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check
index e135f38f8b..5e47c69ed8 100644
--- a/test/files/neg/sealed-final-neg.check
+++ b/test/files/neg/sealed-final-neg.check
@@ -1,7 +1,9 @@
-sealed-final-neg.scala:17: warning: neg1/Foo::bar(I)I is annotated @inline but cannot be inlined: the method is not final and may be overridden.
+sealed-final-neg.scala:17: warning: neg1/Foo::bar(I)I is annotated @inline but could not be inlined:
+The method is not final and may be overridden.
def f = Foo.mkFoo() bar 10
^
-sealed-final-neg.scala:37: warning: neg2/Foo::bar(I)I is annotated @inline but cannot be inlined: the method is not final and may be overridden.
+sealed-final-neg.scala:37: warning: neg2/Foo::bar(I)I is annotated @inline but could not be inlined:
+The method is not final and may be overridden.
def f = Foo.mkFoo() bar 10
^
error: No warnings can be incurred under -Xfatal-warnings.