RFR: 8275775: Add jcmd VM.classes to print details of all classes [v10]

Yi Yang yyang at openjdk.java.net
Mon Mar 7 02:58:59 UTC 2022


On Fri, 4 Mar 2022 09:05:36 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> Add VM.classes to print details of all classes, output looks like:
>> 
>> 1. jcmd VM.classes
>> 
>> KlassAddr Size State Flags LoaderName ClassName
>> 0x0000000800c0b400 62 inited W bootstrap java.lang.invoke.LambdaForm$MH/0x0000000800c0b400
>> 0x0000000800c0b000 62 inited W bootstrap java.lang.invoke.LambdaForm$DMH/0x0000000800c0b000
>> 0x0000000800c0ac00 62 inited W bootstrap java.lang.invoke.LambdaForm$MH/0x0000000800c0ac00
>> ...
>> 
>> 2. jcmd VM.classes verbose
>> 
>> KlassAddr Size State Flags LoaderName ClassName
>> 0x0000000800c0b400 62 inited W bootstrap java.lang.invoke.LambdaForm$MH/0x0000000800c0b400
>> java.lang.invoke.LambdaForm$MH/0x0000000800c0b400 {0x0000000800c0b400}
>>  - instance size: 2
>>  - klass size: 62
>>  - access: final synchronized
>>  - state: inited
>>  - name: 'java/lang/invoke/LambdaForm$MH+0x0000000800c0b400'
>>  - super: 'java/lang/Object'
>>  - sub:
>>  - arrays: NULL
>>  - methods: Array<T>(0x00007f620841f210)
>>  - method ordering: Array<T>(0x0000000800a7e5a8)
>>  - default_methods: Array<T>(0x0000000000000000)
>>  - local interfaces: Array<T>(0x00000008005af748)
>>  - trans. interfaces: Array<T>(0x00000008005af748)
>>  - constants: constant pool [41] {0x00007f620841f030} for 'java/lang/invoke/LambdaForm$MH+0x0000000800c0b400' cache=0x00007f620841f380
>>  - class loader data: loader data: 0x00007f61c804a690 of 'bootstrap' has a class holder
>>  - source file: 'LambdaForm$MH'
>>  - class annotations: Array<T>(0x0000000000000000)
>>  - class type annotations: Array<T>(0x0000000000000000)
>>  - field annotations: Array<T>(0x0000000000000000)
>>  - field type annotations: Array<T>(0x0000000000000000)
>>  - inner classes: Array<T>(0x00000008005af6d8)
>>  - nest members: Array<T>(0x00000008005af6d8)
>>  - permitted subclasses: Array<T>(0x00000008005af6d8)
>>  - java mirror: a 'java/lang/Class'{0x000000011f4b3968} = 'java/lang/invoke/LambdaForm$MH+0x0000000800c0b400'
>>  - vtable length 5 (start addr: 0x0000000800c0b5b8)
>>  - itable length 2 (start addr: 0x0000000800c0b5e0)
>>  - ---- static fields (1 words):
>>  - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112
>>  - ---- non-static fields (0 words):
>>  - non-static oop maps:
>> 0x0000000800c0b000 62 inited W bootstrap java.lang.invoke.LambdaForm$DMH/0x0000000800c0b000
>> java.lang.invoke.LambdaForm$DMH/0x0000000800c0b000 {0x0000000800c0b000}
>>  - instance size: 2
>>  - klass size: 62
>>  - access: final synchronized
>>  - state: inited
>>  - name: 'java/lang/invoke/LambdaForm$DMH+0x0000000800c0b000'
>>  - super: 'java/lang/Object'
>>  - sub:
>>  - arrays: NULL
>>  - methods: Array<T>(0x00007f620841ea68)
>>  - method ordering: Array<T>(0x0000000800a7e5a8)
>>  - default_methods: Array<T>(0x0000000000000000)
>>  - local interfaces: Array<T>(0x00000008005af748)
>>  - trans. interfaces: Array<T>(0x00000008005af748)
>>  - constants: constant pool [49] {0x00007f620841e838} for 'java/lang/invoke/LambdaForm$DMH+0x0000000800c0b000' cache=0x00007f620841ebe0
>>  - class loader data: loader data: 0x00007f61c804a750 of 'bootstrap' has a class holder
>>  - source file: 'LambdaForm$DMH'
>>  - class annotations: Array<T>(0x0000000000000000)
>>  - class type annotations: Array<T>(0x0000000000000000)
>>  - field annotations: Array<T>(0x0000000000000000)
>>  - field type annotations: Array<T>(0x0000000000000000)
>>  - inner classes: Array<T>(0x00000008005af6d8)
>>  - nest members: Array<T>(0x00000008005af6d8)
>>  - permitted subclasses: Array<T>(0x00000008005af6d8)
>>  - java mirror: a 'java/lang/Class'{0x000000011f4b0968} = 'java/lang/invoke/LambdaForm$DMH+0x0000000800c0b000'
>>  - vtable length 5 (start addr: 0x0000000800c0b1b8)
>>  - itable length 2 (start addr: 0x0000000800c0b1e0)
>>  - ---- static fields (1 words):
>>  - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112
>>  - ---- non-static fields (0 words):
>> ...
>
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use %4d

> _Mailing list message from [Bernd Eckenfels](mailto:ecki at zusammenkunft.net) on [hotspot-dev](mailto:hotspot-dev at mail.openjdk.java.net):_
> 
> Hello,
> 
> I would add an additional argument to allow substring filtering on the fully qualified class name (like com/example or UtilClass), since this can creator reduce processing/printing time. But I guess that can be added as an additional feature later on (maybe only the ?verbose? variant can conflict if this is not a option (-verbose?).
> 
> Gruss Bernd -- http://bernd.eckenfels.net ________________________________ Von: serviceability-dev <serviceability-dev-retn at openjdk.java.net> im Auftrag von Yi Yang <yyang at openjdk.java.net> Gesendet: Monday, March 7, 2022 3:33:59 AM An: hotspot-dev at openjdk.java.net <hotspot-dev at openjdk.java.net>; serviceability-dev at openjdk.java.net <serviceability-dev at openjdk.java.net> Betreff: Re: RFR: 8275775: Add jcmd VM.classes to print details of all classes [v10]
> 
> On Fri, 4 Mar 2022 09:05:36 GMT, Yi Yang <yyang at openjdk.org> wrote:
> 
> > > Add VM.classes to print details of all classes, output looks like:
> > > 1. jcmd VM.classes
> > > KlassAddr Size State Flags LoaderName ClassName
> > > 0x0000000800c0b400 62 inited W bootstrap java.lang.invoke.LambdaForm$MH/0x0000000800c0b400
> > > 0x0000000800c0b000 62 inited W bootstrap java.lang.invoke.LambdaForm$DMH/0x0000000800c0b000
> > > 0x0000000800c0ac00 62 inited W bootstrap java.lang.invoke.LambdaForm$MH/0x0000000800c0ac00
> > > ...
> > > 2. jcmd VM.classes verbose
> > > KlassAddr Size State Flags LoaderName ClassName
> > > 0x0000000800c0b400 62 inited W bootstrap java.lang.invoke.LambdaForm$MH/0x0000000800c0b400
> > > java.lang.invoke.LambdaForm$MH/0x0000000800c0b400 {0x0000000800c0b400}
> > > - instance size: 2
> > > - klass size: 62
> > > - access: final synchronized
> > > - state: inited
> > > - name: 'java/lang/invoke/LambdaForm$MH+0x0000000800c0b400'
> > > - super: 'java/lang/Object'
> > > - sub:
> > > - arrays: NULL
> > > - methods: Array<T>(0x00007f620841f210)
> > > - method ordering: Array<T>(0x0000000800a7e5a8)
> > > - default_methods: Array<T>(0x0000000000000000)
> > > - local interfaces: Array<T>(0x00000008005af748)
> > > - trans. interfaces: Array<T>(0x00000008005af748)
> > > - constants: constant pool [41] {0x00007f620841f030} for 'java/lang/invoke/LambdaForm$MH+0x0000000800c0b400' cache=0x00007f620841f380
> > > - class loader data: loader data: 0x00007f61c804a690 of 'bootstrap' has a class holder
> > > - source file: 'LambdaForm$MH'
> > > - class annotations: Array<T>(0x0000000000000000)
> > > - class type annotations: Array<T>(0x0000000000000000)
> > > - field annotations: Array<T>(0x0000000000000000)
> > > - field type annotations: Array<T>(0x0000000000000000)
> > > - inner classes: Array<T>(0x00000008005af6d8)
> > > - nest members: Array<T>(0x00000008005af6d8)
> > > - permitted subclasses: Array<T>(0x00000008005af6d8)
> > > - java mirror: a 'java/lang/Class'{0x000000011f4b3968} = 'java/lang/invoke/LambdaForm$MH+0x0000000800c0b400'
> > > - vtable length 5 (start addr: 0x0000000800c0b5b8)
> > > - itable length 2 (start addr: 0x0000000800c0b5e0)
> > > - ---- static fields (1 words):
> > > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112
> > > - ---- non-static fields (0 words):
> > > - non-static oop maps:
> > > 0x0000000800c0b000 62 inited W bootstrap java.lang.invoke.LambdaForm$DMH/0x0000000800c0b000
> > > java.lang.invoke.LambdaForm$DMH/0x0000000800c0b000 {0x0000000800c0b000}
> > > - instance size: 2
> > > - klass size: 62
> > > - access: final synchronized
> > > - state: inited
> > > - name: 'java/lang/invoke/LambdaForm$DMH+0x0000000800c0b000'
> > > - super: 'java/lang/Object'
> > > - sub:
> > > - arrays: NULL
> > > - methods: Array<T>(0x00007f620841ea68)
> > > - method ordering: Array<T>(0x0000000800a7e5a8)
> > > - default_methods: Array<T>(0x0000000000000000)
> > > - local interfaces: Array<T>(0x00000008005af748)
> > > - trans. interfaces: Array<T>(0x00000008005af748)
> > > - constants: constant pool [49] {0x00007f620841e838} for 'java/lang/invoke/LambdaForm$DMH+0x0000000800c0b000' cache=0x00007f620841ebe0
> > > - class loader data: loader data: 0x00007f61c804a750 of 'bootstrap' has a class holder
> > > - source file: 'LambdaForm$DMH'
> > > - class annotations: Array<T>(0x0000000000000000)
> > > - class type annotations: Array<T>(0x0000000000000000)
> > > - field annotations: Array<T>(0x0000000000000000)
> > > - field type annotations: Array<T>(0x0000000000000000)
> > > - inner classes: Array<T>(0x00000008005af6d8)
> > > - nest members: Array<T>(0x00000008005af6d8)
> > > - permitted subclasses: Array<T>(0x00000008005af6d8)
> > > - java mirror: a 'java/lang/Class'{0x000000011f4b0968} = 'java/lang/invoke/LambdaForm$DMH+0x0000000800c0b000'
> > > - vtable length 5 (start addr: 0x0000000800c0b1b8)
> > > - itable length 2 (start addr: 0x0000000800c0b1e0)
> > > - ---- static fields (1 words):
> > > - static final '_D_0' 'Ljava/lang/invoke/LambdaForm;' @112
> > > - ---- non-static fields (0 words):
> > > ...
> > 
> > 
> > Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
> > use %4d
> 
> Thank you for taking time to help review. 3 approval, I want to merge this tomorrow if no objections/comments.
> 
> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/7105

Hi Bernd,

Class filter has been discussed before on PR(Please follow previous comments for more details). The conclusion is a filter won't save much runtime time. We can leave it to the external tools(grep/awk,etc).

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

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


More information about the serviceability-dev mailing list