On Wed, 14 Apr 2021 11:35:14 GMT, Claes Redestad <redes...@openjdk.org> wrote:

>> This patch reduces work done initializing VarForms - mostly observed when 
>> loading each VarHandle implementation class.
>> 
>> - Lazily resolve MemberNames.
>> - Streamline MethodType creation. This reduces the number of MethodTypes 
>> created. 
>> 
>> Net effect is a reduction in bytecode executed per VH class by 50-60%.
>
> Claes Redestad has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Revert UOE change, ensure VarHandle.isAccessModeSupported behaves well

src/java.base/share/classes/java/lang/invoke/VarForm.java line 136:

> 134:             return memberName_table[mode]
> 135:                 = MethodHandles.Lookup.IMPL_LOOKUP
> 136:                     .resolveOrFail(REF_invokeStatic, implClass, 
> methodName, type);

An alternative way can be:


final MemberName getMemberName(int mode) {
     MemberName mn = getMemberNameOrNull(mode);
     if (mn == null) {
           throw new UnsupportedOperationException();
     }
 }       


This way `resolveMemberName(int mode)` can simply call 
IMPL_LOOKUP.resolveOrNull`.

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

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

Reply via email to