On Mon, 11 Apr 2022 09:34:17 GMT, ExE Boss <[email protected]> wrote:
>> Claes Redestad has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Simplified as suggested by @ExE-Boss
>
> src/java.base/share/classes/java/lang/invoke/VarHandles.java line 719:
>
>> 717: //
>> MethodHandle.linkToStatic(<LINK_TO_STATIC_ARGS>);
>> 718: // } else {
>> 719: // MethodHandle mh =
>> handle.getMethodHandle(ad.mode);
>
> The `direct`‑ness check can be hoisted into an enclosing `if` statement:
> Suggestion:
>
> // if (direct) {
> // if (handle.vform.methodType_table[ad.type] ==
> ad.symbolicMethodTypeErased) {
> //
> MethodHandle.linkToStatic(<LINK_TO_STATIC_ARGS>);
> // return;
> // } else if (handle.vform.getMethodType_V(ad.type) ==
> ad.symbolicMethodTypeErased) {
> //
> MethodHandle.linkToStatic(<LINK_TO_STATIC_ARGS>);
> // return;
> // }
> // }
> // MethodHandle mh = handle.getMethodHandle(ad.mode);
>
>
> Also, any reason `GUARD_METHOD_TEMPLATE_V` uses `LINK_TO_STATIC_ARGS` instead
> of `LINK_TO_STATIC_ARGS_V`?
> How would the performance change if the `isDirect` and `checkExactAccessMode`
> merger was reverted?
Add around 15-20ns/op for these micros.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8160