RFR: 8370248: AOTMapLogger should check if pointer is in AOTMetaspace
Vladimir Kozlov
kvn at openjdk.org
Tue Oct 21 16:05:30 UTC 2025
On Tue, 21 Oct 2025 15:37:06 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> 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()`.
Good.
-------------
Marked as reviewed by kvn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27918#pullrequestreview-3361548446
More information about the hotspot-runtime-dev
mailing list