@@ -17,8 +17,7 @@ import scala.language.unsafeNulls
17
17
class BackendUtils (val postProcessor : PostProcessor ) {
18
18
import postProcessor .{bTypes , frontendAccess }
19
19
import frontendAccess .{compilerSettings }
20
- import bTypes .*
21
- import coreBTypes .jliLambdaMetaFactoryAltMetafactoryHandle
20
+ import bTypes .{coreBTypes , ClassBType , MethodBType }
22
21
23
22
// Keep synchronized with `minTargetVersion` and `maxTargetVersion` in ScalaSettings
24
23
lazy val classfileVersion : Int = compilerSettings.target match {
@@ -45,6 +44,8 @@ class BackendUtils(val postProcessor: PostProcessor) {
45
44
}
46
45
47
46
def collectSerializableLambdas (classNode : ClassNode ): Array [Handle ] = {
47
+ import coreBTypes .jliLambdaMetaFactoryAltMetafactoryHandle
48
+
48
49
val indyLambdaBodyMethods = new mutable.ArrayBuffer [Handle ]
49
50
for (m <- classNode.methods.asScala) {
50
51
val iter = m.instructions.iterator
@@ -59,7 +60,7 @@ class BackendUtils(val postProcessor: PostProcessor) {
59
60
if isSerializable then
60
61
val implMethod = indy.bsmArgs(1 ).asInstanceOf [Handle ]
61
62
indyLambdaBodyMethods += implMethod
62
- case _ =>
63
+ case _ => ()
63
64
}
64
65
}
65
66
}
@@ -90,8 +91,7 @@ class BackendUtils(val postProcessor: PostProcessor) {
90
91
*/
91
92
def addLambdaDeserialize (classNode : ClassNode , implMethodsArray : Array [Handle ]): Unit = {
92
93
import asm .Opcodes ._
93
- import bTypes ._
94
- import coreBTypes ._
94
+ import coreBTypes .{jlIllegalArgExceptionRef , jliLambdaDeserializeBootstrapHandle }
95
95
96
96
val cw = classNode
97
97
@@ -101,12 +101,10 @@ class BackendUtils(val postProcessor: PostProcessor) {
101
101
// stack map frames and invokes the `getCommonSuperClass` method. This method expects all
102
102
// ClassBTypes mentioned in the source code to exist in the map.
103
103
104
- val serlamObjDesc = MethodBType (jliSerializedLambdaRef :: Nil , ObjectRef ).descriptor
105
-
106
- val mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , " $deserializeLambda$" , serlamObjDesc, null , null )
104
+ val mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC , " $deserializeLambda$" , serializedLamdaObjDesc, null , null )
107
105
def emitLambdaDeserializeIndy (targetMethods : Seq [Handle ]): Unit = {
108
106
mv.visitVarInsn(ALOAD , 0 )
109
- mv.visitInvokeDynamicInsn(" lambdaDeserialize" , serlamObjDesc , jliLambdaDeserializeBootstrapHandle, targetMethods : _* )
107
+ mv.visitInvokeDynamicInsn(" lambdaDeserialize" , serializedLamdaObjDesc , jliLambdaDeserializeBootstrapHandle, targetMethods : _* )
110
108
}
111
109
112
110
val targetMethodGroupLimit = 255 - 1 - 3 // JVM limit. See See MAX_MH_ARITY in CallSite.java
@@ -131,6 +129,11 @@ class BackendUtils(val postProcessor: PostProcessor) {
131
129
mv.visitInsn(ARETURN )
132
130
}
133
131
132
+ private lazy val serializedLamdaObjDesc = {
133
+ import coreBTypes .{ObjectRef , jliSerializedLambdaRef }
134
+ MethodBType (jliSerializedLambdaRef :: Nil , ObjectRef ).descriptor
135
+ }
136
+
134
137
/**
135
138
* Visit the class node and collect all referenced nested classes.
136
139
*/
0 commit comments