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

Ioi Lam iklam at openjdk.org
Fri Nov 14 04:50:34 UTC 2025


`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.

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

Commit messages:
 - 8371874: AOTLinkedClassBulkLoader::preload_classes() should not allocate heap objects

Changes: https://git.openjdk.org/jdk/pull/28315/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28315&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8371874
  Stats: 4 lines in 1 file changed: 0 ins; 3 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/28315.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28315/head:pull/28315

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


More information about the hotspot-runtime-dev mailing list