RFR: 8354897: Support Soft/Weak Reference in AOT cache [v8]

Kim Barrett kbarrett at openjdk.org
Wed Apr 30 14:52:53 UTC 2025


On Wed, 30 Apr 2025 14:29:45 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/util/ReferencedKeyMap.java line 353:
>> 
>>> 351:         for (ReferenceKey<K> key : map.keySet()) {
>>> 352:             Object referent = key.get();
>>> 353:             if (referent == null) {
>> 
>> Shouldn't this be `key.refersTo(null)`?
>
> It is immediately passed to `CDS.keepAlive`, two separate calls of `refersTo` and `get` may produce `null` on the second call, I presume.

Sorry, I missed that `referent` was used later if non-null.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24757#discussion_r2068838868


More information about the hotspot-dev mailing list