RFR: 8344913: Improve -Xlog:cds+map+oop logging for Java mirrors

David Holmes dholmes at openjdk.org
Mon Nov 25 04:56:14 UTC 2024


On Sun, 24 Nov 2024 00:46:49 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> The following information is added to the `-Xlog:cds+map+oop` output for examining the `java/lang/Class` oop instances inside the AOT cache:
> 
> - Print the name of the class
> - Print the value of the static fields- 
> - Print the  resolved_reference_array for this class, so it's easy to see what constant pool entries (for Lambdas, etc) are resolved.
> 
> Below is the new and modified output vs the previous version:
> 
> 
> - 0x00000000ffe7af28: @@ Object (0xffe7af28) java.lang.Class
> + 0x00000000ffe7af28: @@ Object (0xffe7af28) java.lang.Class Ljava/lang/System;
>   0x00000000ffe7af28:   40b7b001 0000035b 001bb638 00000000 001a9b90 00000008 00000000 00000000   ...@[...8.......................
>   0x00000000ffe7af48:   00000013 0000000a 00000000 00000000 00000000 00000000 00000000 00000000   ................................
>   0x00000000ffe7af68:   00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000   ................................
>   0x00000000ffe7af88:   00000000 00000000 00000000 fff04c58 00000000 00000000 00000000 00000000   ............XL..................
>   0x00000000ffe7afa8:   00000000 00000000 00000000 00000000 00000000 00000000                     ........................
>    - klass: 'java/lang/Class' 0x00000008001bb638
>    - fields (19 words):
>    - private volatile transient 'classRedefinedCount' 'I' @12  0 (0x00000000)
>    - injected 'klass' 'J' @16 0x00000008001a9b90 (marked metadata pointer @0x00000000ffe7af38 )
>    - injected 'array_klass' 'J' @24  0 (0x0000000000000000)
>    - injected 'oop_size' 'I' @32  19 (0x00000013)
>    - injected 'static_oop_field_count' 'I' @36  10 (0x0000000a)
>    - private volatile transient 'cachedConstructor' 'Ljava/lang/reflect/Constructor;' @40 null
>    - private transient 'name' 'Ljava/lang/String;' @44 null
>    - private transient 'module' 'Ljava/lang/Module;' @48 null
>    - private final 'classLoader' 'Ljava/lang/ClassLoader;' @52 null
>    - private transient 'classData' 'Ljava/lang/Object;' @56 null
>    - private transient 'signers' '[Ljava/lang/Object;' @60 null
>    - private transient 'packageName' 'Ljava/lang/String;' @64 null
>    - private final 'componentType' 'Ljava/lang/Class;' @68 null
>    - private volatile transient 'reflectionData' 'Ljava/lang/ref/SoftReference;' @72 null
>    - private volatile transient 'genericInfo' 'Lsun/reflect/generics/repository/ClassRepository;' @76 null
>    - private volatile transient 'enumConstants' '[Ljava/lang/Object;' @80 null
>    - private volatile transient 'enumConstantDirectory' 'L...

src/hotspot/share/cds/archiveBuilder.cpp line 1461:

> 1459:   //     0x00000007ffc7e840 (0xfff8fd08) java.lang.Class
> 1460:   //     0x00000007ffc000f8 (0xfff8001f) [B length: 11
> 1461:   static void print_oop_with_requested_addr_cr(outputStream* st, oop source_oop, bool print_addr = true, bool print_aot_init = false) {

Pre-existing but it seems very odd to me to have a function called `print_oop_with_requested_addr` and then have a parameter to control whether we print the addr.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22345#discussion_r1855798712


More information about the hotspot-runtime-dev mailing list