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

Ioi Lam iklam at openjdk.org
Thu Aug 14 00:37:39 UTC 2025


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.

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

Commit messages:
 - Added test case for -Xlog:aot+map in production run
 - more clean up
 - Merge branch 'master' into 8362566-log-aot-map-for-existing-aot-cache
 - Fixed crashes on macos -- cannot use _narrow_oop_base as it can wrap around
 - More clean up; print dynamic archive
 - Fixed build
 - more clean up
 - No need for special code to print native ptrs in oops; More clean up
 - Implemented logging of heap roots and constant pool resolved_references()
 - Implemented FakeString
 - ... and 7 more: https://git.openjdk.org/jdk/compare/9c266ae8...889dd5e4

Changes: https://git.openjdk.org/jdk/pull/26514/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26514&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8362566
  Stats: 1617 lines in 13 files changed: 1156 ins; 452 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/26514.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26514/head:pull/26514

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


More information about the hotspot-dev mailing list