RFR: 8333793: Improve BootstrapMethodInvoker for ConstantBootstraps and ProxyGenerator [v2]

Chen Liang liach at openjdk.org
Fri Jun 7 19:25:13 UTC 2024


On Fri, 7 Jun 2024 18:47:53 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> Note that [`ConstantBootstraps​::primitiveClass​(Lookup, String, Class)`] has a static return type of `Class⁠<⁠?⁠>`, so the following is also needed:
>> 
>> /**
>>  * Exact type used of the {@link ConstantBootstraps#primitiveClass(Lookup, String, Class)}
>>  * bootstrap method.
>>  */
>> private static final MethodType CONDY_CLASS_NO_ARG_MT
>> 	= CONDY_GET_STATIC_FINAL_MT.changeReturnType(Class.class);
>> 
>> 
>> [`ConstantBootstraps​::primitiveClass​(Lookup, String, Class)`]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/ConstantBootstraps.html#primitiveClass(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.Class)
>
> It's not the intent of this PR to exhaustively enumerate all methods in `ConstantBootstraps`, primarily those shown to be bootstrap sensitive in some app. I've so far never seen a use of `primitiveClass` (and I admit being ignorant as to why this even exists as a BSM) so I don't have any reason to believe special-casing it will carry its own weight.

For its existence, I think it was the same as null, that they weren't representable by cp entries for bootstrap method args. They are now backed by PrimitiveClassDescImpl, a type of condy, and ClassFile API currently writes loadConstant(primitiveCd) as a condy.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19598#discussion_r1631606873


More information about the core-libs-dev mailing list