RFR: 8244540: Print more information with -XX:+PrintSharedArchiveAndExit

Ioi Lam iklam at openjdk.java.net
Thu Mar 25 23:38:27 UTC 2021


On Thu, 25 Mar 2021 03:54:07 GMT, Yumin Qi <minqi at openjdk.org> wrote:

> Hi, Please review
>   Added more info in printout when -XX:+PrintSharedArchiveAndExit used:
>   archive names (static/dynamic or static only)
>   loaded classes and their loaders
>   number of shared symbols
>   number of shared strings
>   full vm version stored in shared archive.
>   added two tests for custom loader test and dynamic test.
> 
>   Tests: tier1,tier2,tier3,tier4
> 
> Thanks
> Yumin

Looks good overall. I think the order of the output can be changed a little to make it more readable:

VM version: Java HotSpot(TM) 64-Bit Server VM (fastdebug ......

Number of shared symbols: 40699
Number of shared strings: 7601

Base archive name: /jdk2/bld/fastdebug/images/jdk/lib/server/classes.jsa
Base archive version 11

(classes in the base archive)


Dynamic archive name: PrintSharedArchiveAndExit.java-top.jsa
Dynamic archive version 11

(classes in the dynamic archive)

Also, now the counter is reset when you go from Unregistered to Lambda. I think it shouldn't be reset so we can easily tell the combined number of classes in each archive file.

  17: sun.hotspot.WhiteBox loaded by: boot_loader
Shared Unregistered Dictionary
  18: CustomLoadee loaded by: unregistered_loader
Shared Lambda Dictionary
   1: sun.hotspot.WhiteBox$$Lambda$10/0x0000000801045b88 loaded by: boot_loader

src/hotspot/share/classfile/systemDictionaryShared.cpp line 2253:

> 2251:     ResourceMark rm;
> 2252:     _st->print_cr("%4d: %s loaded by: %s", (_index++), record->_klass->external_name(),
> 2253:         class_loader_name_for_shared(record->_klass));

The "loaded by: xxx_loader" seems a bit verbose:

  23: java.lang.invoke.VarHandleLongs$FieldInstanceReadWrite loaded by: boot_loader
  24: java.util.Map loaded by: boot_loader

How about

  23: java.lang.invoke.VarHandleLongs$FieldInstanceReadWrite boot_loader
  24: java.util.Map boot_loader

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

Changes requested by iklam (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3187


More information about the hotspot-runtime-dev mailing list