RFR: 8377339: Implement AOTCacheAccess::get_archived_object using heap roots [v2]
Vladimir Kozlov
kvn at openjdk.org
Tue Feb 10 02:23:01 UTC 2026
On Tue, 10 Feb 2026 01:57:22 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> src/hotspot/share/cds/heapShared.cpp line 658:
>>
>>> 656: AOTArtifactFinder::add_cached_class(method_holder);
>>> 657: }
>>> 658: } else if (AOTCodeCache::is_dumping_code() &&
>>
>> I suggest to use next check for possible any AOT code caching (see my other comment):
>>
>> if (CDSConfig::is_dumping_heap() && AOTCodeCache::is_caching_enabled)
>
> This code is not called during regular oop allocation. Instead, it's called when an oop is copied into the AOT cache.
>
> We call `AOTCodeCache::is_dumping_code()` in another places as well:
>
> https://github.com/openjdk/leyden/blob/10172534fc92bc58dcf7eae6145c781ec50ffabc/src/hotspot/share/cds/aotMetaspace.cpp#L1211
>
> Both cases happen after `AOTCodeCache::init2()` has been called, so `AOTCodeCache::is_dumping_code()` should return the correct value.
It depends when you copy oops into AOT cache. It is fine to use this check If you copy oops before we dump AOT code (at the code lines you pointed).
But it is not fine after AOT code is dumped. At the line 1219 we call `AOTCodeCache::close();` which dumps AOT code and deallocates cache. Code dumping is called from `~AOTCodeCache()` destructor. `AOTCodeCache::is_dumping_code()` will return `false` after that.
-------------
PR Review Comment: https://git.openjdk.org/leyden/pull/108#discussion_r2785441140
More information about the leyden-dev
mailing list