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

Chen Liang liach at openjdk.org
Tue Dec 2 17:27:43 UTC 2025


On Tue, 2 Dec 2025 09:28:03 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Tweak VH usage in some classes
>
> 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.

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

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


More information about the hotspot-dev mailing list