RFR: 8344140: Refactor the discovery of AOT cache artifacts [v3]

Ioi Lam iklam at openjdk.org
Wed Jan 8 02:43:57 UTC 2025


On Tue, 7 Jan 2025 22:52:16 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

> Comment in `AOTClassInitializer::can_archive_initialized_mirror()` refers to `HeapShared::find_all_aot_initialized_classes()` which does not exist anymore:
> 
> ```
>   // When CDSConfig::is_initing_classes_at_dump_time() is enabled,
>   // HeapShared::find_all_aot_initialized_classes() finds the classes of all
>   // heap objects that are reachable from HeapShared::_run_time_special_subgraph,
>   // and mark these classes as aot-inited.
> ```
> 
> And this comment at line 263 in `aotClassInitializer.cpp` also needs to be updated as the enum classes are not unconditionally AOT-initialized:
> 
> ```
>       // above we selected all enums; we must include their super as well
>       {"java/lang/Enum"},
> ```

I fixed the comments and removed the entry for `java/lang/Enum`

> src/hotspot/share/cds/metaspaceShared.cpp line 548:
> 
>> 546:     FileMapInfo::metaspace_pointers_do(it);
>> 547:     AOTArtifactFinder::all_cached_classes_do(it);
>> 548:     SystemDictionaryShared::dumptime_classes_do(it);
> 
> There is some duplicatoin of work in `AOTArtifactFinder::all_cached_classes_do()` and `SystemDictionaryShared::dumptime_classes_do()`. all_cached_classes_do() operates on `_all_cached_classes` which is built using `SystemDictionaryShared::_dumptime_table`. So the iteration over `_dumptime_table` in `SystemDictionaryShared::dumptime_classes_do()` seems redundant.

The call to `SystemDictionaryShared::dumptime_classes_do()` is still necessary. It does more than just discovering the classes. It also walks the `DumpTimeClassInfo` with


info.metaspace_pointers_do(it);


which will walk the loader constraints, etc.

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

PR Comment: https://git.openjdk.org/jdk/pull/22291#issuecomment-2576589873
PR Review Comment: https://git.openjdk.org/jdk/pull/22291#discussion_r1906263814


More information about the hotspot-dev mailing list