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

Albert Mingkun Yang ayang at openjdk.org
Fri Nov 14 09:48: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.

Marked as reviewed by ayang (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/28315#pullrequestreview-3464008421


More information about the hotspot-runtime-dev mailing list