RFR: JDK-8282798 java.lang.runtime.Carrier [v11]

liach duke at openjdk.java.net
Tue Mar 22 13:35:31 UTC 2022


On Tue, 22 Mar 2022 12:56:02 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/runtime/Carrier.java line 574:
>> 
>>> 572:             try {
>>> 573:                 Lookup lookup = MethodHandles.lookup();
>>> 574:                 return lookup.defineHiddenClass(bytes, false, ClassOption.STRONG);
>> 
>> Actually, this lookup object should probably be kept cached.
>
> Which one, the context lookup or the hidden class lookup?

The context lookup used to define the hidden class, not the one returned. Don't know how costly calling the caller sensitive `lookup()` is, if the calls are too expensive then we'd rather cache it in a static final field

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

PR: https://git.openjdk.java.net/jdk/pull/7744


More information about the core-libs-dev mailing list