diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-11-06 13:36:06 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-11-06 15:28:48 +0100 |
commit | e843f3d33baf09e3ad3e84f9bc74c498fcbd21e2 (patch) | |
tree | a210ba9ef10b55e30b8cad66faac278dd075abca /src/compiler | |
parent | 7a12e8110941fb60243453af2d82d0be122ee82d (diff) | |
download | scala-e843f3d33baf09e3ad3e84f9bc74c498fcbd21e2.tar.gz scala-e843f3d33baf09e3ad3e84f9bc74c498fcbd21e2.tar.bz2 scala-e843f3d33baf09e3ad3e84f9bc74c498fcbd21e2.zip |
Use BTypes when building the lambdaMetaFactoryBootstrapHandle
All class internal names that are referenced from a class being
compiled should be referenced through their ClassBType. This makes
sure that the ClassBType is cached in `classBTypeFromInternalName`,
which is required during classfile writing: when ASM computes stack
map frames, we need to answer subtyping queries, for which we need
to look up the ClassBTypes.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala | 6 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index f1e5e1958d..790469d874 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -1345,6 +1345,13 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { lazy val lambdaMetaFactoryBootstrapHandle = new asm.Handle(asm.Opcodes.H_INVOKESTATIC, - definitions.LambdaMetaFactory.fullName('/'), sn.AltMetafactory.toString, - "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;") + coreBTypes.jliLambdaMetafactoryRef.internalName, sn.AltMetafactory.toString, + MethodBType( + List( + coreBTypes.jliMethodHandlesLookupRef, + coreBTypes.StringRef, + coreBTypes.jliMethodTypeRef, + ArrayBType(ObjectRef)), + coreBTypes.jliCallSiteRef + ).descriptor) } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala index 79aa4308c5..028eea9da2 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala @@ -117,6 +117,9 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) { lazy val jliSerializedLambdaRef : ClassBType = classBTypeFromSymbol(requiredClass[java.lang.invoke.SerializedLambda]) lazy val jliMethodHandlesRef : ClassBType = classBTypeFromSymbol(requiredClass[java.lang.invoke.MethodHandles]) lazy val jliMethodHandlesLookupRef : ClassBType = classBTypeFromSymbol(exitingPickler(rootMirror.getRequiredClass("java.lang.invoke.MethodHandles.Lookup"))) // didn't find a reliable non-stringly-typed way that works for inner classes in the backend + lazy val jliMethodTypeRef : ClassBType = classBTypeFromSymbol(requiredClass[java.lang.invoke.MethodType]) + lazy val jliCallSiteRef : ClassBType = classBTypeFromSymbol(requiredClass[java.lang.invoke.CallSite]) + lazy val jliLambdaMetafactoryRef : ClassBType = classBTypeFromSymbol(requiredClass[java.lang.invoke.LambdaMetafactory]) lazy val srLambdaDeserializerRef : ClassBType = classBTypeFromSymbol(requiredModule[scala.runtime.LambdaDeserializer.type].moduleClass) lazy val srBoxesRunTimeRef : ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.BoxesRunTime]) @@ -240,6 +243,9 @@ final class CoreBTypesProxy[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: def jliSerializedLambdaRef : ClassBType = _coreBTypes.jliSerializedLambdaRef def jliMethodHandlesRef : ClassBType = _coreBTypes.jliMethodHandlesRef def jliMethodHandlesLookupRef : ClassBType = _coreBTypes.jliMethodHandlesLookupRef + def jliMethodTypeRef : ClassBType = _coreBTypes.jliMethodTypeRef + def jliCallSiteRef : ClassBType = _coreBTypes.jliCallSiteRef + def jliLambdaMetafactoryRef : ClassBType = _coreBTypes.jliLambdaMetafactoryRef def srLambdaDeserializerRef : ClassBType = _coreBTypes.srLambdaDeserializerRef def srBoxesRunTimeRef : ClassBType = _coreBTypes.srBoxesRunTimeRef |