On Thu, 17 Jul 2025 22:38:48 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.

This pull request has now been integrated.

Changeset: fd30ae98
Author:    Ioi Lam <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/fd30ae988bc512b5d2a5a3fd1bc1ed351af974c7
Stats:     941 lines in 43 files changed: 534 ins; 236 del; 171 mod

8350550: Preload classes from AOT cache during VM bootstrap

Reviewed-by: kvn, heidinga, asmehra

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

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

Reply via email to