RFR: 8344140: Refactor the discovery of AOT cache artifacts [v3]
Ashutosh Mehra
asmehra at openjdk.org
Tue Jan 7 22:54:43 UTC 2025
On Tue, 3 Dec 2024 06:46:22 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> This is a clean up after the initial integration for [JEP 483](https://bugs.openjdk.org/browse/JDK-8315737)
>>
>> - Merged 3 loops into 1 for discovering the classes and oops that should be stored in the AOT cache. About 250 lines of code are deleted.
>> - Added comments in aotArtifactFinder.hpp to describe the logic, which is much simpler than before.
>> - Enum classes are no longer unconditionally AOT-initialized -- an Enum class is AOT-initialized only if we find an archived oop of this type.
>>
>> Note to reviewers:
>>
>> One consequence of this refactoring is that archived oops are now discovered (by heapShared.cpp) before the metadata are copied (by ArchiveBuilder). There are some functions that depend on the old order (metadata were copied before oop discovery), so I had to shuffle them around. Examples are `Modules::check_archived_module_oop()`, or the new code in `Klass::remove_java_mirror()`.
>
> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>
> - Merge branch 'master' into 8344140-consolidate-aot-artifact-gathering-discovery
> - Merge branch 'master' of https://github.com/openjdk/jdk into 8344140-consolidate-aot-artifact-gathering-discovery
> - Fixe 32-bit builds; removed unused function
> - more clean up
> - tmp
> - More clean up
> - Removed unnecessary code
> - 8344140: Consolidate AOT cache code for artifact discovery
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"},
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.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22291#issuecomment-2576376931
PR Review Comment: https://git.openjdk.org/jdk/pull/22291#discussion_r1906128195
More information about the hotspot-dev
mailing list