Many of the fields in archived java.lang.Class objects have predictable values that can be assigned during archive creation time. We should explore doing this after JDK-8315737.
For visualization:
Try "java -Xshare:dump -Xlog:cds+map=debug,cds+map+oops=trace:file=cds.map:none:filesize=0"
See this cds.map:
0x00000007ffc7e9a8: @@ Object (0xfff8fd35) java.lang.Class
- klass: 'java/lang/Class' 0x0000000800007360
- fields (14 words):
- private volatile transient 'classRedefinedCount' 'I' @12 0 (0x00000000)
- injected 'klass' 'J' @16 0 (0x0000000000000000)
- injected 'array_klass' 'J' @24 0x0000000800001cd8 (marked metadata pointer @0x00000007ffc7e9c0 )
- injected 'oop_size' 'I' @32 14 (0x0000000e)
- injected 'static_oop_field_count' 'I' @36 0 (0x00000000)
- 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 'packageName' 'Ljava/lang/String;' @60 null
- private final 'componentType' 'Ljava/lang/Class;' @64 null
- private volatile transient 'reflectionData' 'Ljava/lang/ref/SoftReference;' @68 null
- private volatile transient 'genericInfo' 'Lsun/reflect/generics/repository/ClassRepository;' @72 null
- private volatile transient 'enumConstants' '[Ljava/lang/Object;' @76 null
- private volatile transient 'enumConstantDirectory' 'Ljava/util/Map;' @80 null
- private volatile transient 'annotationData' 'Ljava/lang/Class$AnnotationData;' @84 null
- private volatile transient 'annotationType' 'Lsun/reflect/annotation/AnnotationType;' @88 null
- transient 'classValueMap' 'Ljava/lang/ClassValue$ClassValueMap;' @92 null
- injected 'protection_domain' 'Ljava/lang/Object;' @96 null
- injected 'signers_name' 'Ljava/lang/Object;' @100 null
- injected 'source_file' 'Ljava/lang/Object;' @104 null
For visualization:
Try "java -Xshare:dump -Xlog:cds+map=debug,cds+map+oops=trace:file=cds.map:none:filesize=0"
See this cds.map:
0x00000007ffc7e9a8: @@ Object (0xfff8fd35) java.lang.Class
- klass: 'java/lang/Class' 0x0000000800007360
- fields (14 words):
- private volatile transient 'classRedefinedCount' 'I' @12 0 (0x00000000)
- injected 'klass' 'J' @16 0 (0x0000000000000000)
- injected 'array_klass' 'J' @24 0x0000000800001cd8 (marked metadata pointer @0x00000007ffc7e9c0 )
- injected 'oop_size' 'I' @32 14 (0x0000000e)
- injected 'static_oop_field_count' 'I' @36 0 (0x00000000)
- 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 'packageName' 'Ljava/lang/String;' @60 null
- private final 'componentType' 'Ljava/lang/Class;' @64 null
- private volatile transient 'reflectionData' 'Ljava/lang/ref/SoftReference;' @68 null
- private volatile transient 'genericInfo' 'Lsun/reflect/generics/repository/ClassRepository;' @72 null
- private volatile transient 'enumConstants' '[Ljava/lang/Object;' @76 null
- private volatile transient 'enumConstantDirectory' 'Ljava/util/Map;' @80 null
- private volatile transient 'annotationData' 'Ljava/lang/Class$AnnotationData;' @84 null
- private volatile transient 'annotationType' 'Lsun/reflect/annotation/AnnotationType;' @88 null
- transient 'classValueMap' 'Ljava/lang/ClassValue$ClassValueMap;' @92 null
- injected 'protection_domain' 'Ljava/lang/Object;' @96 null
- injected 'signers_name' 'Ljava/lang/Object;' @100 null
- injected 'source_file' 'Ljava/lang/Object;' @104 null
- relates to
-
JDK-8326430 Avoid patching native pointers in archived heap
- Open