You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// (1) A non-final method can be safe to inline if the receiver type is a final subclass. Example:
308
+
// (1) Special case for trait super accessors. trait T { def f = 1 } generates a static
309
+
// method t$ which calls `invokespecial T.f`. Even if `f` is not final, this call will
310
+
// always resolve to `T.f`. This is a (very) special case. Otherwise, `invokespecial`
311
+
// is only used for private methods, constructors and super calls.
312
+
//
313
+
// (2) A non-final method can be safe to inline if the receiver type is a final subclass. Example:
310
314
// class A { @inline def f = 1 }; object B extends A; B.f // can be inlined
311
315
//
312
-
// TODO: (1) doesn't cover the following example:
316
+
// TODO: (2) doesn't cover the following example:
313
317
// trait TravLike { def map = ... }
314
318
// sealed trait List extends TravLike { ... } // assume map is not overridden
315
319
// final case class :: / final case object Nil
@@ -323,9 +327,10 @@ abstract class CallGraph {
323
327
// TODO: type analysis can render more calls statically resolved. Example:
324
328
// new A.f // can be inlined, the receiver type is known to be exactly A.
325
329
valisStaticallyResolved:Boolean= {
326
-
isNonVirtualCall(call) ||// scala/scala-dev#86: super calls (invokespecial) can be inlined -- TODO: check if that's still needed, and if it's correct: scala-dev#143
0 commit comments