RFR: 8362566: Use -Xlog:aot+map to print contents of existing AOT cache [v5]

Vladimir Kozlov kvn at openjdk.org
Tue Aug 19 23:59:40 UTC 2025


On Thu, 14 Aug 2025 04:27:23 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Implement `-Xlog:aot+map` in the production run:
>> 
>> 
>> $ java -cp HelloWorld.jar -XX:AOTCache=HelloWorld.aot \
>>     -Xlog:aot+map=file=aot.map:none:filesize=0 \
>>     HelloWorld
>> 
>> 
>> I moved the old logging code from archiveBuilder.cpp into a new fille, aotMapLogger.cpp. I did the following to print the map in the production run:
>> 
>> 1. When dumping the AOT cache, `ArchiveBuilder` maintains a list of all the metaspace objects in the archive. However, there's no such list when we are loading from the AOT cache. Therefore, I added a new `RuntimeGatherArchivedMetaspaceObjs` class to discover all the metaspace objects that are stored in the AOT cache.
>> 2. A significant rewrite is needed for printing the oops (see comments around `FakeOop`) because we only have an image of the oops in the AOT cache and these aren't real heap objects.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixed crash with ZGC

src/hotspot/share/cds/aotMapLogger.hpp line 54:

> 52: //
> 53: // Because the output can be large, it's best to save it to a file
> 54: //     java -XX:AOTCache=app.aot -Xlog:aot+map*=trace:file=aot.map:none:filesize=0 --version

why `filesize=0`?

test/hotspot/jtreg/runtime/cds/CDSMapTest.java line 94:

> 92:         vmArgs.add("-Xlog:cds=debug");
> 93:         vmArgs.add("-Xshare:on");
> 94:         vmArgs.add("-Xlog:aot+map=debug,aot+map+oops=trace:file=" + mapName + ":none:filesize=0");

Looks like this test is intended for old CDS archive. Do you have test for new AOTCache workflow?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26514#discussion_r2286644603
PR Review Comment: https://git.openjdk.org/jdk/pull/26514#discussion_r2286648767


More information about the hotspot-dev mailing list