RFR: 8265135: Reduce work initializing VarForms [v3]
Mandy Chung
mchung at openjdk.java.net
Wed Apr 14 17:37:56 UTC 2021
On Wed, 14 Apr 2021 11:35:14 GMT, Claes Redestad <redestad at 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
More information about the core-libs-dev
mailing list