RFR: 8362566: Use -Xlog:aot+map to print contents of existing AOT cache
María Arias de Reyna
duke at openjdk.org
Thu Aug 14 00:37:39 UTC 2025
On Mon, 28 Jul 2025 16:56:32 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.
Tested locally and working fine:
0x00000008004c2128: @@ ConstantPool 528 java.lang.System$In
{constant pool}
- flags: 0x6 on_stack
- holder: 0x00000008000da9c8
- cache: 0x0000000800313528
- resolved_references: 0x0000000000000000
- reference_map: 0x0000000000000000
- resolved_klasses: 0x00000008003134e8
- cp length: 57
- 1 : : klass_index=2 name_and_type_index=3
- 2 : : 'java/io/FileInputStream' {0x00000008000daf48}
- 3 : : name_index=5 signature_index=6
- 4 : : 'java/io/FileInputStream'
- 5 : : '<init>'
- 6 : : '(Ljava/io/FileDescriptor;)V'
- 7 : : klass_index=8 name_and_type_index=9
[...]
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26514#issuecomment-3131536644
More information about the hotspot-dev
mailing list