RFR: 8377339: Implement AOTCacheAccess::get_archived_object using heap roots [v2]

Ioi Lam iklam at openjdk.org
Tue Feb 10 02:46:23 UTC 2026


On Tue, 10 Feb 2026 02:20:04 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> 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.

The oop copying is done before we dump the AOT code. The new call to `AOTCodeCache::is_dumping_code()` happens before the other call to the same function in aotMetaspace.cpp.

Eventually, we should change the order so that AOT code is generated before we collect all artifacts (metaspace objects, oops, and code), but this would be a drastic change so we should delay that after initial AOT code JEP is integrated.

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

PR Review Comment: https://git.openjdk.org/leyden/pull/108#discussion_r2785503214


More information about the leyden-dev mailing list