RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v6]
Chen Liang
liach at openjdk.org
Wed Dec 3 23:44:01 UTC 2025
On Wed, 3 Dec 2025 19:37:25 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> Chen Liang has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Test from Jorn
>> - Copyright years
>
> src/java.base/share/classes/java/lang/invoke/VarHandle.java line 2036:
>
>> 2034: // from two writes (they must not be tearable)
>> 2035: private record Adaption(VarHandle vh, MethodHandle mh) {}
>> 2036: private @Stable Adaption adaption;
>
> Is a soft reference needed here? The situation looks similar to `MH.asTypeSoftCache`. It can keep some classes referred by `vh` alive for unnecessarily long.
I don't think we can use a SoftReference here if we need to achieve constant folding.
Looking at inline_reference_get0, I think we might introduce another field property to trust a reference (potentially in an array) if both that reference and the referent within the reference is non-null. I think that belongs to a separate RFE. What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2586946357
More information about the hotspot-compiler-dev
mailing list