RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]
Chen Liang
liach at openjdk.org
Wed Dec 3 14:11:23 UTC 2025
On Wed, 3 Dec 2025 14:06:00 GMT, Chen Liang <liach at openjdk.org> wrote:
>> I meant that even though objects are immutable, plain semantics might not always do.
>>
>> Reference: https://shipilev.net/blog/2014/safe-public-construction/
>
> MethodHandle is safe. All fields in Method Handle hierarchies are either lazy/stable or final. You can refer to the `invokers` field in `MethodType`, and the `MethodHandle` array in `Invokers` for precedents.
In extreme cases where a barrier is needed, java.lang.invoke already issue necessary barriers, most notably the storeStoreFence, such as https://github.com/openjdk/jdk/blob/135661b4389663b8c2e348d9e61e72cc628636bb/src/java.base/share/classes/java/lang/invoke/CallSite.java#L138
or https://github.com/openjdk/jdk/blob/135661b4389663b8c2e348d9e61e72cc628636bb/src/java.base/share/classes/java/lang/ClassValue.java#L411-L417
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2585270552
More information about the hotspot-compiler-dev
mailing list