RFR: 8350550: Preload classes from AOT cache during VM bootstrap [v11]

Ioi Lam iklam at openjdk.org
Tue Sep 23 03:24:28 UTC 2025


> This PR loads the classes for the boot/platform/app loaders with `AOTLinkedClassBulkLoader::preload_classes()`. This happens at the very beginning of `vmClasses::resolve_all()`, before any Java code is executed. 
> 
> - We essentially iterate over all the classes inside the `AOTLinkedClassTable` and adds them into the system dictionary using the new method `SystemDictionary::preload_class()`.
> - `SystemDictionary::preload_class(..., k)` is lightweight because it's called in a single thread after all super types of `k` have been loaded. So most of the complicated work (such as place holders, circularity detection, etc) in `SystemDictionary::resolve_or_null(..., k)` can be skipped. We also don't need to call into `ClassLoader::load_class()` as the boot/platform/app loaders are well-behaved.
> - In the assembly phase, we record the mirror, package, protection domain, code source, etc, of these classes. So there's no need to programmatically create them in the production run. See `HeapShared::copy_java_mirror()` and also changes in ClassLoader.java and SecureClassLoader.java.

Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 31 commits:

 - @vnkozlov review comments
 - Merge branch 'master' into 8350550-preload-aot-classes-during-vm-bootstrap
 - @ashu-mehra comment - AOTLinkedClassBulkLoader::link_or_init_javabase_classes() should also call exit_on_exception()
 - Fixed 32-bit builds
 - Removed JVMCI-specific checks that are no longer necessary with class preloading -- all CP entries discoverable by JVMCI will always point to already-loaded classes
 - Simplify implementation after JDK-8367366: Do not support -XX:+AOTClassLinking for dynamic CDS archive
 - Merge branch 'master' into 8350550-preload-aot-classes-during-vm-bootstrap
 - Merge branch 'master' into 8350550-preload-aot-classes-during-vm-bootstrap
 - @ashu-mehra comment: removed AOTLinkedClassBulkLoader::is_pending_aot_linked_class
 - @ashu-mehra review comments
 - ... and 21 more: https://git.openjdk.org/jdk/compare/61c5245b...bd08a0b5

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

Changes: https://git.openjdk.org/jdk/pull/26375/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26375&range=10
  Stats: 941 lines in 43 files changed: 534 ins; 236 del; 171 mod
  Patch: https://git.openjdk.org/jdk/pull/26375.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26375/head:pull/26375

PR: https://git.openjdk.org/jdk/pull/26375


More information about the net-dev mailing list