RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]

Vladimir Ivanov vlivanov at openjdk.org
Tue Dec 2 01:45:49 UTC 2025


On Tue, 2 Dec 2025 01:08:19 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/VarHandle.java line 2033:
>> 
>>> 2031: 
>>> 2032:         @ForceInline
>>> 2033:         MethodHandle adaptedMethodHandle(VarHandle vh) {
>> 
>> Can you elaborate, please, how this method is intended to behave?
>
> 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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579287707


More information about the hotspot-compiler-dev mailing list