RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]
Chen Liang
liach at openjdk.org
Tue Dec 2 01:51:47 UTC 2025
On Tue, 2 Dec 2025 01:42:50 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> When this is compiled, `constant` will become either `1` for constant VH and `2` for non-constant VH. So for constant VH, this becomes a stable read. For a non-constant VH, this becomes `getMethodHandle(mode).asType(...)`, equivalent to before.
>
> What's the purpose of `constant == MethodHandleImpl.CONSTANT_YES ` and `constant != MethodHandleImpl.CONSTANT_NO` checks then?
Indeed, I should move the adaptedMh read into `constant == MethodHandleImpl.CONSTANT_YES` block.
`constant != MethodHandleImpl.CONSTANT_NO` prevents capturing any further if the VH is known non-constant; we keep this branch in constant case in case the adapted MH is not ready when we know the VH is constant.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579302480
More information about the hotspot-dev
mailing list