In the initial implementation of JEP 483 (JDK-8315737), there are two loops that discover what hidden classes are required, and what classes should be AOT-initialized:
[1] SystemDictionaryShared::find_all_archivable_classes()
[2] HeapShared::find_all_aot_initialized_classes()
These loops look similar -- they scan the classes, the constant pools (and in the case of the second loop, all the heap objects that can be archived) until a stable state is reached.
This scanning is surprisingly similar to the loop for discovering all the archivable heap objects
[3] HeapShared::archive_objects()
=================
Proposal: consolidate all 3 loops into one -- discover all archivable classes and Java heap objects, and decide which classes need to be aot-initialized.
This should significantly reduce the complexity and code duplication. The single loop will be similar as we don't need to worry about passing information among the three loops.
==================
[1] https://github.com/iklam/jdk/blob/ce4c93eef7b41a3097a65709550707b25cca4afe/src/hotspot/share/classfile/systemDictionaryShared.cpp#L732
[2] https://github.com/iklam/jdk/blob/ce4c93eef7b41a3097a65709550707b25cca4afe/src/hotspot/share/cds/heapShared.cpp#L952
[3] https://github.com/iklam/jdk/blob/ce4c93eef7b41a3097a65709550707b25cca4afe/src/hotspot/share/cds/heapShared.cpp#L767
[1] SystemDictionaryShared::find_all_archivable_classes()
[2] HeapShared::find_all_aot_initialized_classes()
These loops look similar -- they scan the classes, the constant pools (and in the case of the second loop, all the heap objects that can be archived) until a stable state is reached.
This scanning is surprisingly similar to the loop for discovering all the archivable heap objects
[3] HeapShared::archive_objects()
=================
Proposal: consolidate all 3 loops into one -- discover all archivable classes and Java heap objects, and decide which classes need to be aot-initialized.
This should significantly reduce the complexity and code duplication. The single loop will be similar as we don't need to worry about passing information among the three loops.
==================
[1] https://github.com/iklam/jdk/blob/ce4c93eef7b41a3097a65709550707b25cca4afe/src/hotspot/share/classfile/systemDictionaryShared.cpp#L732
[2] https://github.com/iklam/jdk/blob/ce4c93eef7b41a3097a65709550707b25cca4afe/src/hotspot/share/cds/heapShared.cpp#L952
[3] https://github.com/iklam/jdk/blob/ce4c93eef7b41a3097a65709550707b25cca4afe/src/hotspot/share/cds/heapShared.cpp#L767
- relates to
-
JDK-8343023 [premain] AOT cache cleanup umbrella/wishlist
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/be1cdd94
-
Review(master) openjdk/jdk/22291