JDK-8344140 : Refactor the discovery of AOT cache artifacts
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-11-13
  • Updated: 2025-05-27
  • Resolved: 2025-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b06Fixed
Related Reports
Relates :  
Relates :  
Description
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


Comments
Changeset: be1cdd94 Branch: master Author: Ioi Lam <iklam@openjdk.org> Date: 2025-01-15 04:32:47 +0000 URL: https://git.openjdk.org/jdk/commit/be1cdd9450763c5c409bd6e28ec3604cdd90b653
15-01-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22291 Date: 2024-11-21 05:27:43 +0000
21-11-2024