RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]
Per Minborg
pminborg at openjdk.org
Wed Dec 3 10:34:41 UTC 2025
On Tue, 2 Dec 2025 17:24:41 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/VarHandle.java line 2036:
>>
>>> 2034: var constant = MethodHandleImpl.isCompileConstant(vh);
>>> 2035: var cache = adaptedMh;
>>> 2036: if (constant == MethodHandleImpl.CONSTANT_YES && cache != null) {
>>
>> Rookie question: Is there multi-thread considerations here? How about visibility across threads?
>
> MethodHandle is immutable and can be safely published. So this is ok.
I meant that even though objects are immutable, plain semantics might not always do.
Reference: https://shipilev.net/blog/2014/safe-public-construction/
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2584535309
More information about the hotspot-dev
mailing list