On Tue, 2 Dec 2025 01:08:19 GMT, Chen Liang <[email protected]> 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