Skip to content

Commit d604331

Browse files
committed
SD-242 Correctly emit InterfaceMethodRef in bytecode after closure inlining
``` ⚡ qscalac -opt:l:classpath -d /tmp sandbox/test.scala && javap -v -cp /tmp Test | cat -b | grep -i --color '$anonfun$test$1' 26 #17 = Utf8 $anonfun$test$1 27 #18 = NameAndType #17:#13 // $anonfun$test$1:()V 28 #19 = InterfaceMethodref #2.#18 // Test.$anonfun$test$1:()V 59 #50 = MethodHandle #6:#19 // invokestatic Test.$anonfun$test$1:()V 96 0: invokestatic #19 // InterfaceMethod $anonfun$test$1:()V 140 public static void $anonfun$test$1(); 169 #50 invokestatic Test.$anonfun$test$1:()V ```
1 parent ada6b6b commit d604331

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class ClosureOptimizer[BT <: BTypes](val btypes: BT) {
325325
insns.insertBefore(invocation, new InsnNode(DUP))
326326
INVOKESPECIAL
327327
}
328-
val isInterface = bodyOpcode == INVOKEINTERFACE
328+
val isInterface = classBTypeFromInternalName(lambdaBodyHandle.getOwner).isInterface.getOrElse(bodyOpcode == INVOKEINTERFACE) // TODO
329329
val bodyInvocation = new MethodInsnNode(bodyOpcode, lambdaBodyHandle.getOwner, lambdaBodyHandle.getName, lambdaBodyHandle.getDesc, isInterface)
330330
ownerMethod.instructions.insertBefore(invocation, bodyInvocation)
331331

0 commit comments

Comments
 (0)