[lworld] RFR: 8273301: [lworld] Bootstrap of instance-capturing lambda fails for reference favoring primitive types.
Srikanth Adayapalam
sadayapalam at openjdk.java.net
Tue Sep 14 09:17:31 UTC 2021
On Thu, 2 Sep 2021 20:10:36 GMT, Jesper Steen Møller <jespersm at openjdk.org> wrote:
> Fix the test by adjusting bootstrap parameters, like it was fixed in JDK-8271583.
Looks good to me - However, I would like to ask Mandy whether we are working around a problem in the runtime that should really be fixed there. @mlchung Could you please take a look at the code generated with and without fix and see if the change in javac emitted code is the proper way for this to be fixed ?
The failure mode is
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type primitive X; not a subtype of implementation type primitive X
The failing code being:
public java.util.function.Supplier<X> makeCopier();
descriptor: ()Ljava/util/function/Supplier;
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokedynamic #7, 0 // InvokeDynamic #0:get:(LX;)Ljava/util/function/Supplier;
6: areturn
LineNumberTable:
line 12: 0
LocalVariableTable:
Start Length Slot Name Signature
0 7 0 this QX;
and the patch here alters the generated code to be:
public java.util.function.Supplier<X> makeCopier();
descriptor: ()Ljava/util/function/Supplier;
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokedynamic #7, 0 // InvokeDynamic #0:get:(QX;)Ljava/util/function/Supplier;
6: areturn
LineNumberTable:
line 12: 0
LocalVariableTable:
Start Length Slot Name Signature
0 7 0 this QX;
-------------
PR: https://git.openjdk.java.net/valhalla/pull/545
More information about the valhalla-dev
mailing list