On Tue, 2 Dec 2025 01:42:50 GMT, Vladimir Ivanov <[email protected]> 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

Reply via email to