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

Vladimir Ivanov vlivanov at openjdk.org
Tue Dec 2 02:02:46 UTC 2025


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

>> 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.

I still have a hard time reasoning about state transitions of the cache.

1) Why do you limit successful cache read (`cache != null`) to constant `vh` case (`constant == MethodHandleImpl.CONSTANT_YES`)?

2) Why do you avoid cache update in non-constant case (`constant != MethodHandleImpl.CONSTANT_NO`)? What happens if it runs compiled `adaptedMethodHandle` method?

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

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


More information about the hotspot-dev mailing list