On Sat, 20 Sep 2025 00:57:09 GMT, Ioi Lam <[email protected]> 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: > > @ashu-mehra comment - > AOTLinkedClassBulkLoader::link_or_init_javabase_classes() should also call > exit_on_exception()
Few comments. src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp line 60: > 58: // Preloading requires that the Java heap objects of java.lang.Class, > java.lang.Package and > 59: // java.security.ProtectionDomain already exist for the preloaded > classes. Therefore, we support preloading > 60: // only for the classes in the static CDS archive. Classes in the dynamic > archive are not supported because "for the classes in the static CDS archive"? Do you mean "AOT cache"? Or this feature also works for old static CDS archive? src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp line 97: > 95: } > 96: > 97: ClassLoaderData* loader_data = > ClassLoaderData::class_loader_data(loader()); `loader_data` is not used in this method. src/hotspot/share/cds/aotLinkedClassBulkLoader.hpp line 52: > 50: // > 51: // [2] load_javabase_classes() and load_non_javabase_classes(): > 52: // This happens after some Java code is executed, to load aot-linked > classes in the dynamic archive. Previous comment say that dynamic archive is not supported. src/hotspot/share/cds/aotLinkedClassTable.hpp line 45: > 43: > 44: Array<InstanceKlass*>* _boot1; // boot classes in java.base module > 45: Array<InstanceKlass*>* _boot2; // boot classes in all other (named and > unnamed) modules Do you mean JDK's modules or user's modules too? ------------- PR Review: https://git.openjdk.org/jdk/pull/26375#pullrequestreview-3255743679 PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2370759818 PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2370778138 PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2370797359 PR Review Comment: https://git.openjdk.org/jdk/pull/26375#discussion_r2370798743
