RFR: 8213445: jcmd VM.symboltable and VM.stringtable -verbose output contains no shared symbols or strings [v3]

David Holmes dholmes at openjdk.java.net
Wed Apr 20 21:41:28 UTC 2022


On Fri, 15 Apr 2022 23:52:27 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Please review this change which will include shared symbols and strings when using the commands `jcmd VMsymboltable -verbose` and `jcmd VM.stringtable -verbose`, respectively.
>> 
>> This change also prints the shared symbol and shared string tables statistics if the `-verbose` option is not specified.
>> 
>> An example output of shared symbols:
>> 
>> 
>> 48084:
>> VERSION: 1.1
>> 25 2: [Ljava/util/jar/Manifest;
>> 13 65535: jdk/jfr/Event
>> 26 2: [Ljava/lang/AutoCloseable;
>> 5 1: 'app'
>> 10 1: 'platform'
>> 24 65535: jdk/internal/event/Event
>> ---------------
>> Shared symbols:
>> ---------------
>> 0 65535:
>> 10 65535: toIndex =
>> 3 65535: sbc
>> 14 65535: package.access
>> ...
>> ---------------
>> Dynamic shared symbols:
>> ---------------
>> 19 65535: findResourceInPatch
>> 71 65535: (Ljava/util/List<Ljdk/internal/module/ModulePatcher$ResourceFinder;>;)V
>> 8 65535: overflow
>> 49 65535: sun/net/www/protocol/jrt/JavaRuntimeURLConnection
>> 24 65535: com/sun/tools/javac/Main
>> 29 65535: com/sun/tools/javac/main/Main
>> 
>> 
>> Note that the `Dynamic shared symbols` section only shows up if the `jcmd` is used on a running process which is using a dynamic archive.
>> 
>> An example output of symbol table statistics:
>> 
>> 
>> 48494:
>> SymbolTable statistics:
>> Number of buckets       :     32768 =    262144 bytes, each 8
>> Number of entries       :         6 =        96 bytes, each 16
>> Number of literals      :         6 =       152 bytes, avg  25.000
>> Total footprint         :           =    262392 bytes
>> Average bucket size     :     0.000
>> Variance of bucket size :     0.000
>> Std. dev. of bucket size:     0.014
>> Maximum bucket size     :         1
>> Shared Symbol Table statistics:
>> Number of buckets       :     10332
>> Number of entries       :     39893
>> Maximum bucket size     :        13
>> Dynamic Shared Symbol Table statistics:
>> Number of buckets       :        51
>> Number of entries       :        42
>> Maximum bucket size     :         3
>> 
>> 
>> Note that the `Dynamic Shared Symbol Table statistics` section only shows up if the `jcmd` is used on a running process which is using a dynamic archive.
>> 
>> Passed CI tiers 1 and 2 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use @build and ClassFileInstaller.writeJar for creating jar files for the tests under appcds/jcmd

Hi Calvin,

Seems fine. A couple of style nits.

Thanks,
David

src/hotspot/share/classfile/stringTable.cpp line 657:

> 655: }
> 656: 
> 657: static void print_string(Thread* thr, outputStream* st, oop s) {

Nit: if `thr` is the current thread (has to be for the `ResourceMark`) then please call it `current`.

src/hotspot/share/classfile/stringTable.cpp line 660:

> 658:   typeArrayOop value     = java_lang_String::value_no_keepalive(s);
> 659:   int          length    = java_lang_String::length(s);
> 660:   bool         is_latin1 = java_lang_String::is_latin1(s);

Nit: there is no need to align things this way.

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list