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

Ashutosh Mehra asmehra at openjdk.org
Fri Sep 19 18:41:03 UTC 2025


On Fri, 19 Sep 2025 04:46:13 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> 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 incrementally with one additional commit since the last revision:
> 
>   Fixed 32-bit builds

src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp line 184:

> 182: 
> 183: void AOTLinkedClassBulkLoader::link_or_init_javabase_classes(TRAPS) {
> 184:   link_or_init_classes_for_loader(Handle(), AOTLinkedClassTable::get()->boot1(), CHECK);

Is exception check not needed here, like it is done in `link_or_init_non_javabase_classes()`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2364073186


More information about the net-dev mailing list