RFR: 8370248: AOTMapLogger should check if pointer is in AOTMetaspace

Ioi Lam iklam at openjdk.org
Tue Oct 21 15:45:01 UTC 2025


This fixes a recent bug in `AOTMapLogger` that's exposed in macOS 26 testing.

When running the JVM with a valid AOT cache (or AOT cache) with the flag `-Xlog:aot+map=debug`, we use `AOTMapLogger::RuntimeGatherArchivedMetaspaceObjs` to discover all metaspace objects that are contained in the AOT cache.

However, this code is executed after some of the AOT-cached classes are linked. As a result, `RuntimeGatherArchivedMetaspaceObjs::do_unique_ref()` could see instances of `AdapterHandlerEntry` which are dynamically allocated and their addresses are outside of the AOT cache.

In all platforms except macOS 26, the `AdapterHandlerEntry` pointers are all above the address range of the AOT cache, and they are filtered out by subsequent code in `AOTMapLogger`. However, on macOS 26, the `AdapterHandlerEntry` pointers are below the AOT cache, and they caused this assert to fail:

https://github.com/openjdk/jdk/blob/9a88d7f468cdd040bdf4e1ff9441dc9c66eab03e/src/hotspot/share/cds/aotMapLogger.cpp#L240-L242

The fix is simple: filter out all pointers that are outside of the address range of the AOT cache in `do_unique_ref()`.

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

Commit messages:
 - 8370248: AOTMapLogger should check if pointer is in AOTMetaspace

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

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


More information about the hotspot-runtime-dev mailing list