summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-07-06 20:12:53 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2015-07-23 15:02:18 +0200
commit8f272c0ad2d1435b4032188eb2e4cba641605dd4 (patch)
treec0ec51841410bbfcf195d1c95f216a14b5dc3758 /src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
parent1c1d8259b51ede24ccad116ce6f0590d11426a34 (diff)
downloadscala-8f272c0ad2d1435b4032188eb2e4cba641605dd4.tar.gz
scala-8f272c0ad2d1435b4032188eb2e4cba641605dd4.tar.bz2
scala-8f272c0ad2d1435b4032188eb2e4cba641605dd4.zip
[backport] Accessibility checks for methods with an InvokeDynamic instruction
Implements the necessary tests to check if a method with an InvokeDynamic instruction can be inlined into a destination class. Only InvokeDynamic instructions with LambdaMetaFactory as bootstrap methods can be inlined. The accessibility checks cannot be implemented generically, because it depends on what the bootstrap method is doing. In particular, the bootstrap method receives a Lookup object as argument which can be used to access private methods of the class where the InvokeDynamic method is located. A comment in the inliner explains the details.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala b/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
index 4fc05cafdc..4eb24d13e3 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
@@ -1,7 +1,7 @@
package scala.tools.nsc
package backend.jvm
-import scala.tools.asm.tree.{AbstractInsnNode, MethodNode}
+import scala.tools.asm.tree.{InvokeDynamicInsnNode, AbstractInsnNode, MethodNode}
import scala.tools.nsc.backend.jvm.BTypes.InternalName
import scala.reflect.internal.util.Position
import scala.tools.nsc.settings.ScalaSettings
@@ -246,6 +246,11 @@ object BackendReporting {
case class ResultingMethodTooLarge(calleeDeclarationClass: InternalName, name: String, descriptor: String,
callsiteClass: InternalName, callsiteName: String, callsiteDesc: String) extends CannotInlineWarning
+ case object UnknownInvokeDynamicInstruction extends OptimizerWarning {
+ override def toString = "The callee contains an InvokeDynamic instruction with an unknown bootstrap method (not a LambdaMetaFactory)."
+ def emitWarning(settings: ScalaSettings): Boolean = settings.YoptWarningEmitAtInlineFailed
+ }
+
/**
* Used in `rewriteClosureApplyInvocations` when a closure apply callsite cannot be rewritten
* to the closure body method.