Integrated: 8371874: AOTLinkedClassBulkLoader::preload_classes() should not allocate heap objects

Ioi Lam iklam at openjdk.org
Fri Nov 14 18:45:16 UTC 2025


On Fri, 14 Nov 2025 04:43:51 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> `AOTLinkedClassBulkLoader::preload_classes()` indirectly calls `java_lang_Class::restore_archived_mirror()` which can allocate an `int` array for the `init_lock`. However, the `init_lock` has already been allocated during AOT cache assembly :
> 
> 
> java_lang_Class::create_scratch_mirror()
> -> allocate_mirror()
>   -> initialize_mirror_fields()
>     -> set_init_lock()
> 
> 
> So there's no need to allocate it again in the production run.

This pull request has now been integrated.

Changeset: 58b601ac
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/58b601ac4250a455e3f25f8505ead8c130eba642
Stats:     4 lines in 1 file changed: 0 ins; 3 del; 1 mod

8371874: AOTLinkedClassBulkLoader::preload_classes() should not allocate heap objects

Reviewed-by: shade, ayang

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

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


More information about the hotspot-runtime-dev mailing list