RFR: 8264644: More complete ClassLoaderData for cld->print()

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

RFR: 8264644: More complete ClassLoaderData for cld->print()

Yi Yang
Trivial chanage to make debugging happy, now cld->print() would be:

ClassLoaderData(0x00007ff17432b670)
 - name                'platform'
 - holder              WeakHandle: 0x00000007fef56678
 - class loader        0x7ff17432b828
 - metaspace           0x7ff17468a0b0
 - unloading           false
 - class mirror holder false
 - modified oops       true
 - keep alive          0
 - claim               strong
 - handles             43
 - dependency count    0
 - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
 - packages            0x7ff17432bc20
 - module              0x7ff17432c520
 - unnamed module      0x7ff17432c3d0
 - dictionary          0x7ff17432c470
 - deallocate list     0x7ff0a4023bd0

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

Commit messages:
 - make debugging happy

Changes: https://git.openjdk.java.net/jdk/pull/3323/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264644
  Stats: 52 lines in 2 files changed: 40 ins; 4 del; 8 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3323.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3323/head:pull/3323

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: More complete ClassLoaderData for cld->print()

Coleen Phillimore-3
On Fri, 2 Apr 2021 09:42:01 GMT, Yi Yang <[hidden email]> wrote:

> Trivial chanage to make debugging happy, now cld->print() would be:
>
> ClassLoaderData(0x00007ff17432b670)
>  - name                'platform'
>  - holder              WeakHandle: 0x00000007fef56678
>  - class loader        0x7ff17432b828
>  - metaspace           0x7ff17468a0b0
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          0
>  - claim               strong
>  - handles             43
>  - dependency count    0
>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>  - packages            0x7ff17432bc20
>  - module              0x7ff17432c520
>  - unnamed module      0x7ff17432c3d0
>  - dictionary          0x7ff17432c470
>  - deallocate list     0x7ff0a4023bd0

This looks nice. If you use -XX:+PrintSystemDictionaryAtExit with this change, is it pages and pages long?  Or does it look ok?  Thank you for doing this!

src/hotspot/share/classfile/classLoaderData.cpp line 950:

> 948:   out->print   (" - holder              ");
> 949:   _holder.print_on(out);
> 950:   out->print_cr("");

indent 2 here.

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

Marked as reviewed by coleenp (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: More complete ClassLoaderData for cld->print()

Yi Yang
On Fri, 2 Apr 2021 12:47:04 GMT, Coleen Phillimore <[hidden email]> wrote:

>> Trivial chanage to make debugging happy, now cld->print() would be:
>>
>> ClassLoaderData(0x00007ff17432b670)
>>  - name                'platform'
>>  - holder              WeakHandle: 0x00000007fef56678
>>  - class loader        0x7ff17432b828
>>  - metaspace           0x7ff17468a0b0
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          0
>>  - claim               strong
>>  - handles             43
>>  - dependency count    0
>>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>>  - packages            0x7ff17432bc20
>>  - module              0x7ff17432c520
>>  - unnamed module      0x7ff17432c3d0
>>  - dictionary          0x7ff17432c470
>>  - deallocate list     0x7ff0a4023bd0
>
> This looks nice. If you use -XX:+PrintSystemDictionaryAtExit with this change, is it pages and pages long?  Or does it look ok?  Thank you for doing this!

Hi @coleenp, thanks for looking at this, it does outputs too detailed content for klasses(actually that's what I want to see), if you think it is too much detail for most people, I can print detailed content of klasses of CLD only when -XX:+Verbose.
...
ClassLoaderData(0x00007fea483e5a50)
 - name                'app'
 - holder              WeakHandle: 0x00000007fef56d98
 - class loader        0x7fea483e5c08
 - metaspace           (nil)
 - unloading           false
 - class mirror holder false
 - modified oops       true
 - keep alive          0
 - claim               none
 - handles             20
 - dependency count    0
 - klasses             { }
 - packages            0x7fea483e5df0
 - module              0x7fea483ea640
 - unnamed module      0x7fea483e65a0
 - dictionary          0x7fea483e6640
 - deallocate list     (nil)
ClassLoaderData(0x00007fea482ee640)
 - name                'platform'
 - holder              WeakHandle: 0x00000007fef56678
 - class loader        0x7fea482ee7f8
 - metaspace           (nil)
 - unloading           false
 - class mirror holder false
 - modified oops       true
 - keep alive          0
 - claim               none
 - handles             24
 - dependency count    0
 - klasses             { }
 - packages            0x7fea482eebf0
 - module              0x7fea482ef4f0
 - unnamed module      0x7fea482ef3a0
 - dictionary          0x7fea482ef440
 - deallocate list     (nil)
ClassLoaderData(0x00007fea482e01f0)
 - name                'bootstrap'
 - class loader        (nil)
 - metaspace           0x7fea48391b60
 - unloading           false
 - class mirror holder false
 - modified oops       true
 - keep alive          1
 - claim               none
 - handles             668
 - dependency count    0
 - klasses             {java.lang.Shutdown$Lock,java.lang.Shutdown,[Ljava.nio.charset.CoderResult;,java.nio.charset.CoderResult,java.nio.HeapCharBuffer,java.nio.CharBuffer,java.lang.Readable,java.lang.invoke.StringConcatFactory$3,java.lang.invoke.StringConcatFactory$2,java.lang.invoke.StringConcatFactory$1,java.lang.invoke.StringConcatFactory,jdk.internal.util.Preconditions,sun.net.util.IPAddressUtil,sun.net.www.protocol.file.Handler,java.net.URLStreamHandler,java.util.HexFormat,sun.net.www.ParseUtil,[Ljava.io.File$PathStatus;,java.io.File$PathStatus,java.net.URL$3,jdk.internal.access.JavaNetURLAccess,java.net.URL$DefaultFactory,java.net.URLStreamHandlerFactory,jdk.internal.loader.URLClassPath,jdk.internal.loader.BootLoader,java.util.ArrayDeque,java.util.Deque,java.util.Queue,jdk.internal.loader.NativeLibraries$2,jdk.internal.loader.NativeLibraries$NativeLibraryImpl,jdk.internal.loader.NativeLibrary,java.security.ProtectionDomain$JavaSecurityAccessImpl,jdk.internal.access.JavaSecurit
 yAccess,java.util.WeakHashMap$KeySet,java.util.Collections$SetFromMap,[Ljava.util.WeakHashMap$Entry;,java.util.WeakHashMap$Entry,java.util.WeakHashMap,java.lang.ClassLoader$ParallelLoaders,[Ljava.security.cert.Certificate;,java.security.cert.Certificate,java.net.URI$1,jdk.internal.access.JavaNetUriAccess,jdk.internal.loader.ClassLoaderValue,jdk.internal.loader.AbstractClassLoaderValue,jdk.internal.module.ModuleBootstrap$Counters,jdk.internal.module.ModulePatcher,jdk.internal.util.ArraysSupport,java.io.UnixFileSystem,java.io.FileSystem,java.io.DefaultFileSystem,java.io.File,java.lang.module.ModuleDescriptor$1,jdk.internal.access.JavaLangModuleAccess,java.lang.reflect.Modifier,sun.invoke.util.VerifyAccess,jdk.internal.module.ModuleBootstrap,java.lang.invoke.MethodHandleStatics,java.lang.IllegalArgumentException,java.util.Collections$EmptyMap,java.util.Collections$EmptyList,java.util.Collections$EmptySet,java.util.Collections,jdk.internal.misc.OSEnvironment,jdk.internal.misc.Signal$Nat
 iveHandler,[Ljava.util.Hashtable$Entry;,java.util.Hashtable$Entry,jdk.internal.misc.Signal,java.lang.Terminator$1,jdk.internal.misc.Signal$Handler,java.lang.Terminator,java.io.BufferedWriter,java.nio.ByteOrder,java.nio.HeapByteBuffer,java.nio.Buffer$1,jdk.internal.access.JavaNioAccess,jdk.internal.misc.ScopedMemoryAccess,java.nio.ByteBuffer,java.nio.charset.CodingErrorAction,sun.nio.cs.UTF_8$Encoder,java.nio.charset.CharsetEncoder,sun.nio.cs.StreamEncoder,sun.nio.cs.UTF_8,sun.nio.cs.Unicode,sun.nio.cs.HistoricallyNamedCharset,sun.security.action.GetPropertyAction,java.util.concurrent.atomic.AtomicInteger,java.lang.ThreadLocal,sun.nio.cs.StandardCharsets,java.nio.charset.spi.CharsetProvider,java.nio.charset.Charset,java.io.OutputStreamWriter,java.io.Writer,java.io.BufferedOutputStream,java.io.PrintStream,java.io.FilterOutputStream,java.io.BufferedInputStream,java.io.FilterInputStream,java.io.FileOutputStream,java.io.OutputStream,java.io.Flushable,java.io.FileDescriptor$1,jdk.internal
 .access.JavaIOFileDescriptorAccess,java.io.FileDescriptor,java.io.FileInputStream,jdk.internal.util.StaticProperty,java.util.HashMap$EntryIterator,java.util.HashMap$HashIterator,java.util.HashMap$EntrySet,java.lang.CharacterDataLatin1,java.lang.CharacterData,java.util.Arrays,java.lang.VersionProps,java.lang.StringConcatHelper,jdk.internal.util.SystemProps$Raw,jdk.internal.util.SystemProps,jdk.internal.misc.VM,java.lang.System$2,jdk.internal.access.JavaLangAccess,java.lang.ref.Finalizer$FinalizerThread,java.lang.ref.Reference$1,jdk.internal.access.JavaLangRefAccess,java.lang.ref.ReferenceQueue$Lock,java.lang.ref.ReferenceQueue$Null,java.lang.ref.ReferenceQueue,jdk.internal.ref.Cleaner,java.lang.ref.Reference$ReferenceHandler,jdk.internal.reflect.ReflectionFactory,jdk.internal.reflect.ReflectionFactory$GetReflectionFactoryAction,java.security.PrivilegedAction,java.util.concurrent.ConcurrentHashMap$ReservationNode,java.util.concurrent.locks.LockSupport,java.util.concurrent.ConcurrentHa
 shMap$CounterCell,[Ljava.util.concurrent.ConcurrentHashMap$Segment;,java.util.concurrent.ConcurrentHashMap$Segment,[Ljava.util.concurrent.locks.ReentrantLock;,java.util.concurrent.locks.ReentrantLock,[Ljava.util.concurrent.locks.Lock;,java.util.concurrent.locks.Lock,java.lang.Runtime,java.util.HashMap$TreeNode,java.util.LinkedHashMap$Entry,java.util.KeyValueHolder,java.util.ImmutableCollections$MapN$MapNIterator,java.util.ImmutableCollections$MapN$1,java.lang.Math,jdk.internal.reflect.Reflection,java.util.Objects,java.lang.invoke.MethodHandles$Lookup,java.lang.StringLatin1,java.lang.reflect.ReflectPermission,java.security.BasicPermission,java.security.Permission,java.security.Guard,java.lang.invoke.MemberName$Factory,java.lang.invoke.MethodHandles,jdk.internal.access.SharedSecrets,java.lang.reflect.ReflectAccess,jdk.internal.access.JavaLangReflectAccess,jdk.internal.misc.CDS,java.lang.String$CaseInsensitiveComparator,java.util.Comparator,[Ljava.io.ObjectStreamField;,java.io.ObjectSt
 reamField,[Ljava.util.jar.Manifest;,[Ljava.net.URL;,java.lang.ArithmeticException,java.lang.NullPointerException,[J,[[I,[I,[S,[B,[D,[F,[C,[Z,java.lang.Module$ArchivedData,jdk.internal.module.ArchivedBootLayer,jdk.internal.loader.BuiltinClassLoader$LoadedModule,java.util.HashSet,java.util.AbstractSet,[Ljdk.internal.module.ServicesCatalog$ServiceProvider;,jdk.internal.module.ServicesCatalog$ServiceProvider,java.util.concurrent.CopyOnWriteArrayList,[Ljdk.internal.module.ServicesCatalog;,jdk.internal.module.ServicesCatalog,[Ljava.util.concurrent.ConcurrentHashMap$Node;,java.util.concurrent.ConcurrentHashMap$Node,jdk.internal.loader.NativeLibraries,java.security.ProtectionDomain$Key,[Ljava.security.Principal;,java.security.Principal,jdk.internal.loader.ClassLoaders$BootClassLoader,jdk.internal.loader.ArchivedClassLoaders,[Ljdk.internal.math.FDBigInteger;,jdk.internal.math.FDBigInteger,java.lang.ModuleLayer,java.util.ImmutableCollections,jdk.internal.module.ModuleLoaderMap$Mapper,java.uti
 l.function.Function,[Ljava.lang.module.ResolvedModule;,java.lang.module.ResolvedModule,java.lang.module.Configuration,[Ljava.util.HashMap$Node;,java.util.HashMap$Node,[Ljava.util.Map$Entry;,java.util.Map$Entry,java.util.HashMap,java.util.Collections$UnmodifiableMap,[Ljdk.internal.module.ModuleHashes;,jdk.internal.module.ModuleHashes,[Ljdk.internal.module.ModuleTarget;,jdk.internal.module.ModuleTarget,java.util.ImmutableCollections$ListN,[Ljava.lang.module.ModuleDescriptor$Opens;,java.lang.module.ModuleDescriptor$Opens,jdk.internal.module.SystemModuleFinders$3,jdk.internal.module.ModuleHashes$HashSupplier,jdk.internal.module.SystemModuleFinders$2,java.util.function.Supplier,java.net.URI,java.util.ImmutableCollections$List12,java.util.ImmutableCollections$AbstractImmutableList,[Ljava.lang.module.ModuleDescriptor$Provides;,java.lang.module.ModuleDescriptor$Provides,[Ljava.lang.module.ModuleDescriptor$Exports;,java.lang.module.ModuleDescriptor$Exports,[Ljava.lang.module.ModuleDescriptor
 $Requires$Modifier;,java.lang.module.ModuleDescriptor$Requires$Modifier,[Ljava.lang.Enum;,java.lang.Enum,[Ljava.lang.module.ModuleDescriptor$Requires;,java.lang.module.ModuleDescriptor$Requires,java.util.ImmutableCollections$Set12,java.lang.module.ModuleDescriptor$Version,[Ljava.lang.module.ModuleDescriptor;,java.lang.module.ModuleDescriptor,jdk.internal.module.ModuleReferenceImpl,[Ljava.lang.module.ModuleReference;,java.lang.module.ModuleReference,java.util.ImmutableCollections$SetN,java.util.ImmutableCollections$AbstractImmutableSet,java.util.Set,java.util.ImmutableCollections$AbstractImmutableCollection,jdk.internal.module.SystemModuleFinders$SystemModuleFinder,java.lang.module.ModuleFinder,jdk.internal.module.ArchivedModuleGraph,[Lsun.util.locale.BaseLocale;,sun.util.locale.BaseLocale,java.util.ImmutableCollections$MapN,java.util.ImmutableCollections$AbstractImmutableMap,java.util.jar.Attributes$Name,java.lang.Character$CharacterCache,java.lang.Short$ShortCache,java.lang.Byte$By
 teCache,java.lang.Long$LongCache,java.lang.Integer$IntegerCache,jdk.internal.vm.vector.VectorSupport$VectorShuffle,jdk.internal.vm.vector.VectorSupport$VectorMask,jdk.internal.vm.vector.VectorSupport$Vector,jdk.internal.vm.vector.VectorSupport$VectorPayload,jdk.internal.vm.vector.VectorSupport,java.lang.reflect.RecordComponent,java.util.Iterator,[Ljava.lang.Long;,java.lang.Long,[Ljava.lang.Integer;,java.lang.Integer,[Ljava.lang.Short;,java.lang.Short,[Ljava.lang.Byte;,java.lang.Byte,java.lang.Double,java.lang.Float,[Ljava.lang.Number;,java.lang.Number,[Ljava.lang.Character;,java.lang.Character,java.lang.Boolean,java.util.concurrent.locks.AbstractOwnableSynchronizer,java.lang.LiveStackFrameInfo,java.lang.LiveStackFrame,java.lang.StackFrameInfo,java.lang.StackWalker$StackFrame,java.lang.StackStreamFactory$AbstractStackWalker,java.lang.StackWalker,java.nio.Buffer,[Ljava.lang.StackTraceElement;,java.lang.StackTraceElement,java.util.ArrayList,java.util.RandomAccess,java.util.AbstractList
 ,java.util.List,java.util.AbstractCollection,java.util.Collection,java.lang.Iterable,java.util.concurrent.ConcurrentHashMap,java.util.concurrent.ConcurrentMap,java.util.AbstractMap,java.security.CodeSource,jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.ClassLoaders$AppClassLoader,jdk.internal.loader.ClassLoaders,jdk.internal.loader.BuiltinClassLoader,java.util.jar.Manifest,java.net.URL,java.io.ByteArrayInputStream,java.io.InputStream,java.io.Closeable,java.lang.AutoCloseable,jdk.internal.module.Modules,jdk.internal.misc.Unsafe,jdk.internal.misc.UnsafeConstants,java.lang.StringBuilder,java.lang.StringBuffer,java.lang.AbstractStringBuilder,java.lang.Appendable,java.lang.AssertionStatusDirectives,java.lang.invoke.VolatileCallSite,java.lang.invoke.MutableCallSite,java.lang.invoke.ConstantCallSite,java.lang.invoke.MethodHandleNatives$CallSiteContext,jdk.internal.invoke.NativeEntryPoint,java.lang.invoke.CallSite,java.lang.BootstrapMethodError,[Ljava.lang.invoke.M
 ethodType;,java.lang.invoke.MethodType,[Ljava.lang.invoke.TypeDescriptor$OfMethod;,java.lang.invoke.TypeDescriptor$OfMethod,[Ljava.lang.invoke.LambdaForm;,java.lang.invoke.LambdaForm,java.lang.invoke.MethodHandleNatives,java.lang.invoke.ResolvedMethodName,java.lang.invoke.MemberName,java.lang.invoke.VarHandle,java.lang.invoke.DirectMethodHandle,[Ljava.lang.invoke.MethodHandle;,java.lang.invoke.MethodHandle,jdk.internal.reflect.NativeConstructorAccessorImpl,jdk.internal.reflect.CallerSensitive,[Ljava.lang.annotation.Annotation;,java.lang.annotation.Annotation,jdk.internal.reflect.UnsafeStaticFieldAccessorImpl,jdk.internal.reflect.UnsafeFieldAccessorImpl,jdk.internal.reflect.FieldAccessorImpl,jdk.internal.reflect.FieldAccessor,jdk.internal.reflect.ConstantPool,jdk.internal.reflect.DelegatingClassLoader,jdk.internal.reflect.ConstructorAccessorImpl,jdk.internal.reflect.ConstructorAccessor,jdk.internal.reflect.MethodAccessorImpl,jdk.internal.reflect.MethodAccessor,jdk.internal.reflect.Ma
 gicAccessorImpl,[Ljava.lang.reflect.Constructor;,java.lang.reflect.Constructor,[Ljava.lang.reflect.Method;,java.lang.reflect.Method,[Ljava.lang.reflect.Executable;,java.lang.reflect.Executable,java.lang.reflect.Parameter,java.lang.reflect.Field,[Ljava.lang.reflect.Member;,java.lang.reflect.Member,[Ljava.lang.reflect.AccessibleObject;,java.lang.reflect.AccessibleObject,[Ljava.lang.Module;,java.lang.Module,java.util.Properties,java.util.Hashtable,java.util.Map,java.util.Dictionary,[Ljava.lang.ThreadGroup;,java.lang.ThreadGroup,[Ljava.lang.Thread$UncaughtExceptionHandler;,java.lang.Thread$UncaughtExceptionHandler,[Ljava.lang.Thread;,java.lang.Thread,[Ljava.lang.Runnable;,java.lang.Runnable,java.lang.ref.Finalizer,java.lang.ref.PhantomReference,java.lang.ref.FinalReference,[Ljava.lang.ref.WeakReference;,java.lang.ref.WeakReference,[Ljava.lang.ref.SoftReference;,java.lang.ref.SoftReference,[Ljava.lang.ref.Reference;,java.lang.ref.Reference,java.lang.IllegalMonitorStateException,java.lang
 .StackOverflowError,[Ljava.lang.OutOfMemoryError;,java.lang.OutOfMemoryError,java.lang.InternalError,[Ljava.lang.VirtualMachineError;,java.lang.VirtualMachineError,java.lang.ArrayStoreException,java.lang.ClassCastException,java.lang.NoClassDefFoundError,java.lang.LinkageError,java.lang.Record,java.lang.ClassNotFoundException,java.lang.ReflectiveOperationException,java.security.SecureClassLoader,java.security.AccessController,java.security.AccessControlContext,[Ljava.security.ProtectionDomain;,java.security.ProtectionDomain,java.lang.SecurityManager,java.lang.RuntimeException,java.lang.Exception,java.lang.ThreadDeath,[Ljava.lang.Error;,java.lang.Error,[Ljava.lang.Throwable;,java.lang.Throwable,java.lang.System,[Ljava.lang.ClassLoader;,java.lang.ClassLoader,[Ljava.lang.Cloneable;,java.lang.Cloneable,[Ljava.lang.Class;,java.lang.Class,[Ljava.lang.invoke.TypeDescriptor$OfField;,java.lang.invoke.TypeDescriptor$OfField,[Ljava.lang.invoke.TypeDescriptor;,java.lang.invoke.TypeDescriptor,[Lj
 ava.lang.reflect.Type;,java.lang.reflect.Type,[Ljava.lang.reflect.GenericDeclaration;,java.lang.reflect.GenericDeclaration,[Ljava.lang.reflect.AnnotatedElement;,java.lang.reflect.AnnotatedElement,[Ljava.lang.String;,java.lang.String,[Ljava.lang.constant.ConstantDesc;,java.lang.constant.ConstantDesc,[Ljava.lang.constant.Constable;,java.lang.constant.Constable,[Ljava.lang.CharSequence;,java.lang.CharSequence,[Ljava.lang.Comparable;,java.lang.Comparable,[Ljava.io.Serializable;,java.io.Serializable,[[Ljava.lang.Object;,[Ljava.lang.Object;,java.lang.Object, }
 - packages            0x7fea482e03a0
 - module              0x7fea482e5030
 - unnamed module      0x7fea482e0b50
 - dictionary          0x7fea482e0bf0
 - jmethod count       3
 - deallocate list     (nil)

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: More complete ClassLoaderData for cld->print()

Coleen Phillimore-3
On Fri, 2 Apr 2021 14:40:25 GMT, Yi Yang <[hidden email]> wrote:

>> This looks nice. If you use -XX:+PrintSystemDictionaryAtExit with this change, is it pages and pages long?  Or does it look ok?  Thank you for doing this!
>
> Hi @coleenp, thanks for looking at this, it does outputs too detailed content for klasses(actually that's what I want to see), if you think it is too much detail for most people, I can print detailed content of klasses of CLD only when -XX:+Verbose.
> ...
> ClassLoaderData(0x00007fea483e5a50)
>  - name                'app'
>  - holder              WeakHandle: 0x00000007fef56d98
>  - class loader        0x7fea483e5c08
>  - metaspace           (nil)
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          0
>  - claim               none
>  - handles             20
>  - dependency count    0
>  - klasses             { }
>  - packages            0x7fea483e5df0
>  - module              0x7fea483ea640
>  - unnamed module      0x7fea483e65a0
>  - dictionary          0x7fea483e6640
>  - deallocate list     (nil)
> ClassLoaderData(0x00007fea482ee640)
>  - name                'platform'
>  - holder              WeakHandle: 0x00000007fef56678
>  - class loader        0x7fea482ee7f8
>  - metaspace           (nil)
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          0
>  - claim               none
>  - handles             24
>  - dependency count    0
>  - klasses             { }
>  - packages            0x7fea482eebf0
>  - module              0x7fea482ef4f0
>  - unnamed module      0x7fea482ef3a0
>  - dictionary          0x7fea482ef440
>  - deallocate list     (nil)
> ClassLoaderData(0x00007fea482e01f0)
>  - name                'bootstrap'
>  - class loader        (nil)
>  - metaspace           0x7fea48391b60
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          1
>  - claim               none
>  - handles             668
>  - dependency count    0
>  - klasses             {java.lang.Shutdown$Lock,java.lang.Shutdown,[Ljava.nio.charset.CoderResult;,java.nio.charset.CoderResult,java.nio.HeapCharBuffer,java.nio.CharBuffer,java.lang.Readable,java.lang.invoke.StringConcatFactory$3,java.lang.invoke.StringConcatFactory$2,java.lang.invoke.StringConcatFactory$1,java.lang.invoke.StringConcatFactory,jdk.internal.util.Preconditions,sun.net.util.IPAddressUtil,sun.net.www.protocol.file.Handler,java.net.URLStreamHandler,java.util.HexFormat,sun.net.www.ParseUtil,[Ljava.io.File$PathStatus;,java.io.File$PathStatus,java.net.URL$3,jdk.internal.access.JavaNetURLAccess,java.net.URL$DefaultFactory,java.net.URLStreamHandlerFactory,jdk.internal.loader.URLClassPath,jdk.internal.loader.BootLoader,java.util.ArrayDeque,java.util.Deque,java.util.Queue,jdk.internal.loader.NativeLibraries$2,jdk.internal.loader.NativeLibraries$NativeLibraryImpl,jdk.internal.loader.NativeLibrary,java.security.ProtectionDomain$JavaSecurityAccessImpl,jdk.internal.access.JavaSecur
 ityAccess,java.util.WeakHashMap$KeySet,java.util.Collections$SetFromMap,[Ljava.util.WeakHashMap$Entry;,java.util.WeakHashMap$Entry,java.util.WeakHashMap,java.lang.ClassLoader$ParallelLoaders,[Ljava.security.cert.Certificate;,java.security.cert.Certificate,java.net.URI$1,jdk.internal.access.JavaNetUriAccess,jdk.internal.loader.ClassLoaderValue,jdk.internal.loader.AbstractClassLoaderValue,jdk.internal.module.ModuleBootstrap$Counters,jdk.internal.module.ModulePatcher,jdk.internal.util.ArraysSupport,java.io.UnixFileSystem,java.io.FileSystem,java.io.DefaultFileSystem,java.io.File,java.lang.module.ModuleDescriptor$1,jdk.internal.access.JavaLangModuleAccess,java.lang.reflect.Modifier,sun.invoke.util.VerifyAccess,jdk.internal.module.ModuleBootstrap,java.lang.invoke.MethodHandleStatics,java.lang.IllegalArgumentException,java.util.Collections$EmptyMap,java.util.Collections$EmptyList,java.util.Collections$EmptySet,java.util.Collections,jdk.internal.misc.OSEnvironment,jdk.internal.misc.Signal$N
 ativeHandler,[Ljava.util.Hashtable$Entry;,java.util.Hashtable$Entry,jdk.internal.misc.Signal,java.lang.Terminator$1,jdk.internal.misc.Signal$Handler,java.lang.Terminator,java.io.BufferedWriter,java.nio.ByteOrder,java.nio.HeapByteBuffer,java.nio.Buffer$1,jdk.internal.access.JavaNioAccess,jdk.internal.misc.ScopedMemoryAccess,java.nio.ByteBuffer,java.nio.charset.CodingErrorAction,sun.nio.cs.UTF_8$Encoder,java.nio.charset.CharsetEncoder,sun.nio.cs.StreamEncoder,sun.nio.cs.UTF_8,sun.nio.cs.Unicode,sun.nio.cs.HistoricallyNamedCharset,sun.security.action.GetPropertyAction,java.util.concurrent.atomic.AtomicInteger,java.lang.ThreadLocal,sun.nio.cs.StandardCharsets,java.nio.charset.spi.CharsetProvider,java.nio.charset.Charset,java.io.OutputStreamWriter,java.io.Writer,java.io.BufferedOutputStream,java.io.PrintStream,java.io.FilterOutputStream,java.io.BufferedInputStream,java.io.FilterInputStream,java.io.FileOutputStream,java.io.OutputStream,java.io.Flushable,java.io.FileDescriptor$1,jdk.intern
 al.access.JavaIOFileDescriptorAccess,java.io.FileDescriptor,java.io.FileInputStream,jdk.internal.util.StaticProperty,java.util.HashMap$EntryIterator,java.util.HashMap$HashIterator,java.util.HashMap$EntrySet,java.lang.CharacterDataLatin1,java.lang.CharacterData,java.util.Arrays,java.lang.VersionProps,java.lang.StringConcatHelper,jdk.internal.util.SystemProps$Raw,jdk.internal.util.SystemProps,jdk.internal.misc.VM,java.lang.System$2,jdk.internal.access.JavaLangAccess,java.lang.ref.Finalizer$FinalizerThread,java.lang.ref.Reference$1,jdk.internal.access.JavaLangRefAccess,java.lang.ref.ReferenceQueue$Lock,java.lang.ref.ReferenceQueue$Null,java.lang.ref.ReferenceQueue,jdk.internal.ref.Cleaner,java.lang.ref.Reference$ReferenceHandler,jdk.internal.reflect.ReflectionFactory,jdk.internal.reflect.ReflectionFactory$GetReflectionFactoryAction,java.security.PrivilegedAction,java.util.concurrent.ConcurrentHashMap$ReservationNode,java.util.concurrent.locks.LockSupport,java.util.concurrent.Concurrent
 HashMap$CounterCell,[Ljava.util.concurrent.ConcurrentHashMap$Segment;,java.util.concurrent.ConcurrentHashMap$Segment,[Ljava.util.concurrent.locks.ReentrantLock;,java.util.concurrent.locks.ReentrantLock,[Ljava.util.concurrent.locks.Lock;,java.util.concurrent.locks.Lock,java.lang.Runtime,java.util.HashMap$TreeNode,java.util.LinkedHashMap$Entry,java.util.KeyValueHolder,java.util.ImmutableCollections$MapN$MapNIterator,java.util.ImmutableCollections$MapN$1,java.lang.Math,jdk.internal.reflect.Reflection,java.util.Objects,java.lang.invoke.MethodHandles$Lookup,java.lang.StringLatin1,java.lang.reflect.ReflectPermission,java.security.BasicPermission,java.security.Permission,java.security.Guard,java.lang.invoke.MemberName$Factory,java.lang.invoke.MethodHandles,jdk.internal.access.SharedSecrets,java.lang.reflect.ReflectAccess,jdk.internal.access.JavaLangReflectAccess,jdk.internal.misc.CDS,java.lang.String$CaseInsensitiveComparator,java.util.Comparator,[Ljava.io.ObjectStreamField;,java.io.Object
 StreamField,[Ljava.util.jar.Manifest;,[Ljava.net.URL;,java.lang.ArithmeticException,java.lang.NullPointerException,[J,[[I,[I,[S,[B,[D,[F,[C,[Z,java.lang.Module$ArchivedData,jdk.internal.module.ArchivedBootLayer,jdk.internal.loader.BuiltinClassLoader$LoadedModule,java.util.HashSet,java.util.AbstractSet,[Ljdk.internal.module.ServicesCatalog$ServiceProvider;,jdk.internal.module.ServicesCatalog$ServiceProvider,java.util.concurrent.CopyOnWriteArrayList,[Ljdk.internal.module.ServicesCatalog;,jdk.internal.module.ServicesCatalog,[Ljava.util.concurrent.ConcurrentHashMap$Node;,java.util.concurrent.ConcurrentHashMap$Node,jdk.internal.loader.NativeLibraries,java.security.ProtectionDomain$Key,[Ljava.security.Principal;,java.security.Principal,jdk.internal.loader.ClassLoaders$BootClassLoader,jdk.internal.loader.ArchivedClassLoaders,[Ljdk.internal.math.FDBigInteger;,jdk.internal.math.FDBigInteger,java.lang.ModuleLayer,java.util.ImmutableCollections,jdk.internal.module.ModuleLoaderMap$Mapper,java.u
 til.function.Function,[Ljava.lang.module.ResolvedModule;,java.lang.module.ResolvedModule,java.lang.module.Configuration,[Ljava.util.HashMap$Node;,java.util.HashMap$Node,[Ljava.util.Map$Entry;,java.util.Map$Entry,java.util.HashMap,java.util.Collections$UnmodifiableMap,[Ljdk.internal.module.ModuleHashes;,jdk.internal.module.ModuleHashes,[Ljdk.internal.module.ModuleTarget;,jdk.internal.module.ModuleTarget,java.util.ImmutableCollections$ListN,[Ljava.lang.module.ModuleDescriptor$Opens;,java.lang.module.ModuleDescriptor$Opens,jdk.internal.module.SystemModuleFinders$3,jdk.internal.module.ModuleHashes$HashSupplier,jdk.internal.module.SystemModuleFinders$2,java.util.function.Supplier,java.net.URI,java.util.ImmutableCollections$List12,java.util.ImmutableCollections$AbstractImmutableList,[Ljava.lang.module.ModuleDescriptor$Provides;,java.lang.module.ModuleDescriptor$Provides,[Ljava.lang.module.ModuleDescriptor$Exports;,java.lang.module.ModuleDescriptor$Exports,[Ljava.lang.module.ModuleDescript
 or$Requires$Modifier;,java.lang.module.ModuleDescriptor$Requires$Modifier,[Ljava.lang.Enum;,java.lang.Enum,[Ljava.lang.module.ModuleDescriptor$Requires;,java.lang.module.ModuleDescriptor$Requires,java.util.ImmutableCollections$Set12,java.lang.module.ModuleDescriptor$Version,[Ljava.lang.module.ModuleDescriptor;,java.lang.module.ModuleDescriptor,jdk.internal.module.ModuleReferenceImpl,[Ljava.lang.module.ModuleReference;,java.lang.module.ModuleReference,java.util.ImmutableCollections$SetN,java.util.ImmutableCollections$AbstractImmutableSet,java.util.Set,java.util.ImmutableCollections$AbstractImmutableCollection,jdk.internal.module.SystemModuleFinders$SystemModuleFinder,java.lang.module.ModuleFinder,jdk.internal.module.ArchivedModuleGraph,[Lsun.util.locale.BaseLocale;,sun.util.locale.BaseLocale,java.util.ImmutableCollections$MapN,java.util.ImmutableCollections$AbstractImmutableMap,java.util.jar.Attributes$Name,java.lang.Character$CharacterCache,java.lang.Short$ShortCache,java.lang.Byte$
 ByteCache,java.lang.Long$LongCache,java.lang.Integer$IntegerCache,jdk.internal.vm.vector.VectorSupport$VectorShuffle,jdk.internal.vm.vector.VectorSupport$VectorMask,jdk.internal.vm.vector.VectorSupport$Vector,jdk.internal.vm.vector.VectorSupport$VectorPayload,jdk.internal.vm.vector.VectorSupport,java.lang.reflect.RecordComponent,java.util.Iterator,[Ljava.lang.Long;,java.lang.Long,[Ljava.lang.Integer;,java.lang.Integer,[Ljava.lang.Short;,java.lang.Short,[Ljava.lang.Byte;,java.lang.Byte,java.lang.Double,java.lang.Float,[Ljava.lang.Number;,java.lang.Number,[Ljava.lang.Character;,java.lang.Character,java.lang.Boolean,java.util.concurrent.locks.AbstractOwnableSynchronizer,java.lang.LiveStackFrameInfo,java.lang.LiveStackFrame,java.lang.StackFrameInfo,java.lang.StackWalker$StackFrame,java.lang.StackStreamFactory$AbstractStackWalker,java.lang.StackWalker,java.nio.Buffer,[Ljava.lang.StackTraceElement;,java.lang.StackTraceElement,java.util.ArrayList,java.util.RandomAccess,java.util.AbstractLi
 st,java.util.List,java.util.AbstractCollection,java.util.Collection,java.lang.Iterable,java.util.concurrent.ConcurrentHashMap,java.util.concurrent.ConcurrentMap,java.util.AbstractMap,java.security.CodeSource,jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.ClassLoaders$AppClassLoader,jdk.internal.loader.ClassLoaders,jdk.internal.loader.BuiltinClassLoader,java.util.jar.Manifest,java.net.URL,java.io.ByteArrayInputStream,java.io.InputStream,java.io.Closeable,java.lang.AutoCloseable,jdk.internal.module.Modules,jdk.internal.misc.Unsafe,jdk.internal.misc.UnsafeConstants,java.lang.StringBuilder,java.lang.StringBuffer,java.lang.AbstractStringBuilder,java.lang.Appendable,java.lang.AssertionStatusDirectives,java.lang.invoke.VolatileCallSite,java.lang.invoke.MutableCallSite,java.lang.invoke.ConstantCallSite,java.lang.invoke.MethodHandleNatives$CallSiteContext,jdk.internal.invoke.NativeEntryPoint,java.lang.invoke.CallSite,java.lang.BootstrapMethodError,[Ljava.lang.invoke
 .MethodType;,java.lang.invoke.MethodType,[Ljava.lang.invoke.TypeDescriptor$OfMethod;,java.lang.invoke.TypeDescriptor$OfMethod,[Ljava.lang.invoke.LambdaForm;,java.lang.invoke.LambdaForm,java.lang.invoke.MethodHandleNatives,java.lang.invoke.ResolvedMethodName,java.lang.invoke.MemberName,java.lang.invoke.VarHandle,java.lang.invoke.DirectMethodHandle,[Ljava.lang.invoke.MethodHandle;,java.lang.invoke.MethodHandle,jdk.internal.reflect.NativeConstructorAccessorImpl,jdk.internal.reflect.CallerSensitive,[Ljava.lang.annotation.Annotation;,java.lang.annotation.Annotation,jdk.internal.reflect.UnsafeStaticFieldAccessorImpl,jdk.internal.reflect.UnsafeFieldAccessorImpl,jdk.internal.reflect.FieldAccessorImpl,jdk.internal.reflect.FieldAccessor,jdk.internal.reflect.ConstantPool,jdk.internal.reflect.DelegatingClassLoader,jdk.internal.reflect.ConstructorAccessorImpl,jdk.internal.reflect.ConstructorAccessor,jdk.internal.reflect.MethodAccessorImpl,jdk.internal.reflect.MethodAccessor,jdk.internal.reflect.
 MagicAccessorImpl,[Ljava.lang.reflect.Constructor;,java.lang.reflect.Constructor,[Ljava.lang.reflect.Method;,java.lang.reflect.Method,[Ljava.lang.reflect.Executable;,java.lang.reflect.Executable,java.lang.reflect.Parameter,java.lang.reflect.Field,[Ljava.lang.reflect.Member;,java.lang.reflect.Member,[Ljava.lang.reflect.AccessibleObject;,java.lang.reflect.AccessibleObject,[Ljava.lang.Module;,java.lang.Module,java.util.Properties,java.util.Hashtable,java.util.Map,java.util.Dictionary,[Ljava.lang.ThreadGroup;,java.lang.ThreadGroup,[Ljava.lang.Thread$UncaughtExceptionHandler;,java.lang.Thread$UncaughtExceptionHandler,[Ljava.lang.Thread;,java.lang.Thread,[Ljava.lang.Runnable;,java.lang.Runnable,java.lang.ref.Finalizer,java.lang.ref.PhantomReference,java.lang.ref.FinalReference,[Ljava.lang.ref.WeakReference;,java.lang.ref.WeakReference,[Ljava.lang.ref.SoftReference;,java.lang.ref.SoftReference,[Ljava.lang.ref.Reference;,java.lang.ref.Reference,java.lang.IllegalMonitorStateException,java.la
 ng.StackOverflowError,[Ljava.lang.OutOfMemoryError;,java.lang.OutOfMemoryError,java.lang.InternalError,[Ljava.lang.VirtualMachineError;,java.lang.VirtualMachineError,java.lang.ArrayStoreException,java.lang.ClassCastException,java.lang.NoClassDefFoundError,java.lang.LinkageError,java.lang.Record,java.lang.ClassNotFoundException,java.lang.ReflectiveOperationException,java.security.SecureClassLoader,java.security.AccessController,java.security.AccessControlContext,[Ljava.security.ProtectionDomain;,java.security.ProtectionDomain,java.lang.SecurityManager,java.lang.RuntimeException,java.lang.Exception,java.lang.ThreadDeath,[Ljava.lang.Error;,java.lang.Error,[Ljava.lang.Throwable;,java.lang.Throwable,java.lang.System,[Ljava.lang.ClassLoader;,java.lang.ClassLoader,[Ljava.lang.Cloneable;,java.lang.Cloneable,[Ljava.lang.Class;,java.lang.Class,[Ljava.lang.invoke.TypeDescriptor$OfField;,java.lang.invoke.TypeDescriptor$OfField,[Ljava.lang.invoke.TypeDescriptor;,java.lang.invoke.TypeDescriptor,[
 Ljava.lang.reflect.Type;,java.lang.reflect.Type,[Ljava.lang.reflect.GenericDeclaration;,java.lang.reflect.GenericDeclaration,[Ljava.lang.reflect.AnnotatedElement;,java.lang.reflect.AnnotatedElement,[Ljava.lang.String;,java.lang.String,[Ljava.lang.constant.ConstantDesc;,java.lang.constant.ConstantDesc,[Ljava.lang.constant.Constable;,java.lang.constant.Constable,[Ljava.lang.CharSequence;,java.lang.CharSequence,[Ljava.lang.Comparable;,java.lang.Comparable,[Ljava.io.Serializable;,java.io.Serializable,[[Ljava.lang.Object;,[Ljava.lang.Object;,java.lang.Object, }
>  - packages            0x7fea482e03a0
>  - module              0x7fea482e5030
>  - unnamed module      0x7fea482e0b50
>  - dictionary          0x7fea482e0bf0
>  - jmethod count       3
>  - deallocate list     (nil)

I was just using PrintSystemDictionaryAtExit and wanted to ignore the CLDG information, which is already quite verbose for this option, so there was a lot of scrolling.

It's sort of a small change to add a nonproduct PrintClassLoaderDataGraphAtExit and use that to print the CLDG at exit and remove it from PrintSystemDictionaryAtExit.  Then we can each get the info we want.

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: More complete ClassLoaderData for cld->print() [v2]

Yi Yang
In reply to this post by Yi Yang
> Trivial chanage to make debugging happy, now cld->print() would be:
>
> ClassLoaderData(0x00007ff17432b670)
>  - name                'platform'
>  - holder              WeakHandle: 0x00000007fef56678
>  - class loader        0x7ff17432b828
>  - metaspace           0x7ff17468a0b0
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          0
>  - claim               strong
>  - handles             43
>  - dependency count    0
>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>  - packages            0x7ff17432bc20
>  - module              0x7ff17432c520
>  - unnamed module      0x7ff17432c3d0
>  - dictionary          0x7ff17432c470
>  - deallocate list     0x7ff0a4023bd0

Yi Yang has updated the pull request incrementally with one additional commit since the last revision:

  new flag PrintClassLoaderDataGraphAtExit

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3323/files
  - new: https://git.openjdk.java.net/jdk/pull/3323/files/d4ff71b1..bfb2261d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=00-01

  Stats: 14 lines in 3 files changed: 8 ins; 0 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3323.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3323/head:pull/3323

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: More complete ClassLoaderData for cld->print() [v2]

Yi Yang
In reply to this post by Coleen Phillimore-3
On Fri, 2 Apr 2021 15:00:46 GMT, Coleen Phillimore <[hidden email]> wrote:

>> Hi @coleenp, thanks for looking at this, it does outputs too detailed content for klasses(actually that's what I want to see), if you think it is too much detail for most people, I can print detailed content of klasses of CLD only when -XX:+Verbose.
>> ...
>> ClassLoaderData(0x00007fea483e5a50)
>>  - name                'app'
>>  - holder              WeakHandle: 0x00000007fef56d98
>>  - class loader        0x7fea483e5c08
>>  - metaspace           (nil)
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          0
>>  - claim               none
>>  - handles             20
>>  - dependency count    0
>>  - klasses             { }
>>  - packages            0x7fea483e5df0
>>  - module              0x7fea483ea640
>>  - unnamed module      0x7fea483e65a0
>>  - dictionary          0x7fea483e6640
>>  - deallocate list     (nil)
>> ClassLoaderData(0x00007fea482ee640)
>>  - name                'platform'
>>  - holder              WeakHandle: 0x00000007fef56678
>>  - class loader        0x7fea482ee7f8
>>  - metaspace           (nil)
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          0
>>  - claim               none
>>  - handles             24
>>  - dependency count    0
>>  - klasses             { }
>>  - packages            0x7fea482eebf0
>>  - module              0x7fea482ef4f0
>>  - unnamed module      0x7fea482ef3a0
>>  - dictionary          0x7fea482ef440
>>  - deallocate list     (nil)
>> ClassLoaderData(0x00007fea482e01f0)
>>  - name                'bootstrap'
>>  - class loader        (nil)
>>  - metaspace           0x7fea48391b60
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          1
>>  - claim               none
>>  - handles             668
>>  - dependency count    0
>>  - klasses             {java.lang.Shutdown$Lock,java.lang.Shutdown,[Ljava.nio.charset.CoderResult;,java.nio.charset.CoderResult,java.nio.HeapCharBuffer,java.nio.CharBuffer,java.lang.Readable,java.lang.invoke.StringConcatFactory$3,java.lang.invoke.StringConcatFactory$2,java.lang.invoke.StringConcatFactory$1,java.lang.invoke.StringConcatFactory,jdk.internal.util.Preconditions,sun.net.util.IPAddressUtil,sun.net.www.protocol.file.Handler,java.net.URLStreamHandler,java.util.HexFormat,sun.net.www.ParseUtil,[Ljava.io.File$PathStatus;,java.io.File$PathStatus,java.net.URL$3,jdk.internal.access.JavaNetURLAccess,java.net.URL$DefaultFactory,java.net.URLStreamHandlerFactory,jdk.internal.loader.URLClassPath,jdk.internal.loader.BootLoader,java.util.ArrayDeque,java.util.Deque,java.util.Queue,jdk.internal.loader.NativeLibraries$2,jdk.internal.loader.NativeLibraries$NativeLibraryImpl,jdk.internal.loader.NativeLibrary,java.security.ProtectionDomain$JavaSecurityAccessImpl,jdk.internal.access.JavaSecu
 rityAccess,java.util.WeakHashMap$KeySet,java.util.Collections$SetFromMap,[Ljava.util.WeakHashMap$Entry;,java.util.WeakHashMap$Entry,java.util.WeakHashMap,java.lang.ClassLoader$ParallelLoaders,[Ljava.security.cert.Certificate;,java.security.cert.Certificate,java.net.URI$1,jdk.internal.access.JavaNetUriAccess,jdk.internal.loader.ClassLoaderValue,jdk.internal.loader.AbstractClassLoaderValue,jdk.internal.module.ModuleBootstrap$Counters,jdk.internal.module.ModulePatcher,jdk.internal.util.ArraysSupport,java.io.UnixFileSystem,java.io.FileSystem,java.io.DefaultFileSystem,java.io.File,java.lang.module.ModuleDescriptor$1,jdk.internal.access.JavaLangModuleAccess,java.lang.reflect.Modifier,sun.invoke.util.VerifyAccess,jdk.internal.module.ModuleBootstrap,java.lang.invoke.MethodHandleStatics,java.lang.IllegalArgumentException,java.util.Collections$EmptyMap,java.util.Collections$EmptyList,java.util.Collections$EmptySet,java.util.Collections,jdk.internal.misc.OSEnvironment,jdk.internal.misc.Signal$
 NativeHandler,[Ljava.util.Hashtable$Entry;,java.util.Hashtable$Entry,jdk.internal.misc.Signal,java.lang.Terminator$1,jdk.internal.misc.Signal$Handler,java.lang.Terminator,java.io.BufferedWriter,java.nio.ByteOrder,java.nio.HeapByteBuffer,java.nio.Buffer$1,jdk.internal.access.JavaNioAccess,jdk.internal.misc.ScopedMemoryAccess,java.nio.ByteBuffer,java.nio.charset.CodingErrorAction,sun.nio.cs.UTF_8$Encoder,java.nio.charset.CharsetEncoder,sun.nio.cs.StreamEncoder,sun.nio.cs.UTF_8,sun.nio.cs.Unicode,sun.nio.cs.HistoricallyNamedCharset,sun.security.action.GetPropertyAction,java.util.concurrent.atomic.AtomicInteger,java.lang.ThreadLocal,sun.nio.cs.StandardCharsets,java.nio.charset.spi.CharsetProvider,java.nio.charset.Charset,java.io.OutputStreamWriter,java.io.Writer,java.io.BufferedOutputStream,java.io.PrintStream,java.io.FilterOutputStream,java.io.BufferedInputStream,java.io.FilterInputStream,java.io.FileOutputStream,java.io.OutputStream,java.io.Flushable,java.io.FileDescriptor$1,jdk.inter
 nal.access.JavaIOFileDescriptorAccess,java.io.FileDescriptor,java.io.FileInputStream,jdk.internal.util.StaticProperty,java.util.HashMap$EntryIterator,java.util.HashMap$HashIterator,java.util.HashMap$EntrySet,java.lang.CharacterDataLatin1,java.lang.CharacterData,java.util.Arrays,java.lang.VersionProps,java.lang.StringConcatHelper,jdk.internal.util.SystemProps$Raw,jdk.internal.util.SystemProps,jdk.internal.misc.VM,java.lang.System$2,jdk.internal.access.JavaLangAccess,java.lang.ref.Finalizer$FinalizerThread,java.lang.ref.Reference$1,jdk.internal.access.JavaLangRefAccess,java.lang.ref.ReferenceQueue$Lock,java.lang.ref.ReferenceQueue$Null,java.lang.ref.ReferenceQueue,jdk.internal.ref.Cleaner,java.lang.ref.Reference$ReferenceHandler,jdk.internal.reflect.ReflectionFactory,jdk.internal.reflect.ReflectionFactory$GetReflectionFactoryAction,java.security.PrivilegedAction,java.util.concurrent.ConcurrentHashMap$ReservationNode,java.util.concurrent.locks.LockSupport,java.util.concurrent.Concurren
 tHashMap$CounterCell,[Ljava.util.concurrent.ConcurrentHashMap$Segment;,java.util.concurrent.ConcurrentHashMap$Segment,[Ljava.util.concurrent.locks.ReentrantLock;,java.util.concurrent.locks.ReentrantLock,[Ljava.util.concurrent.locks.Lock;,java.util.concurrent.locks.Lock,java.lang.Runtime,java.util.HashMap$TreeNode,java.util.LinkedHashMap$Entry,java.util.KeyValueHolder,java.util.ImmutableCollections$MapN$MapNIterator,java.util.ImmutableCollections$MapN$1,java.lang.Math,jdk.internal.reflect.Reflection,java.util.Objects,java.lang.invoke.MethodHandles$Lookup,java.lang.StringLatin1,java.lang.reflect.ReflectPermission,java.security.BasicPermission,java.security.Permission,java.security.Guard,java.lang.invoke.MemberName$Factory,java.lang.invoke.MethodHandles,jdk.internal.access.SharedSecrets,java.lang.reflect.ReflectAccess,jdk.internal.access.JavaLangReflectAccess,jdk.internal.misc.CDS,java.lang.String$CaseInsensitiveComparator,java.util.Comparator,[Ljava.io.ObjectStreamField;,java.io.Objec
 tStreamField,[Ljava.util.jar.Manifest;,[Ljava.net.URL;,java.lang.ArithmeticException,java.lang.NullPointerException,[J,[[I,[I,[S,[B,[D,[F,[C,[Z,java.lang.Module$ArchivedData,jdk.internal.module.ArchivedBootLayer,jdk.internal.loader.BuiltinClassLoader$LoadedModule,java.util.HashSet,java.util.AbstractSet,[Ljdk.internal.module.ServicesCatalog$ServiceProvider;,jdk.internal.module.ServicesCatalog$ServiceProvider,java.util.concurrent.CopyOnWriteArrayList,[Ljdk.internal.module.ServicesCatalog;,jdk.internal.module.ServicesCatalog,[Ljava.util.concurrent.ConcurrentHashMap$Node;,java.util.concurrent.ConcurrentHashMap$Node,jdk.internal.loader.NativeLibraries,java.security.ProtectionDomain$Key,[Ljava.security.Principal;,java.security.Principal,jdk.internal.loader.ClassLoaders$BootClassLoader,jdk.internal.loader.ArchivedClassLoaders,[Ljdk.internal.math.FDBigInteger;,jdk.internal.math.FDBigInteger,java.lang.ModuleLayer,java.util.ImmutableCollections,jdk.internal.module.ModuleLoaderMap$Mapper,java.
 util.function.Function,[Ljava.lang.module.ResolvedModule;,java.lang.module.ResolvedModule,java.lang.module.Configuration,[Ljava.util.HashMap$Node;,java.util.HashMap$Node,[Ljava.util.Map$Entry;,java.util.Map$Entry,java.util.HashMap,java.util.Collections$UnmodifiableMap,[Ljdk.internal.module.ModuleHashes;,jdk.internal.module.ModuleHashes,[Ljdk.internal.module.ModuleTarget;,jdk.internal.module.ModuleTarget,java.util.ImmutableCollections$ListN,[Ljava.lang.module.ModuleDescriptor$Opens;,java.lang.module.ModuleDescriptor$Opens,jdk.internal.module.SystemModuleFinders$3,jdk.internal.module.ModuleHashes$HashSupplier,jdk.internal.module.SystemModuleFinders$2,java.util.function.Supplier,java.net.URI,java.util.ImmutableCollections$List12,java.util.ImmutableCollections$AbstractImmutableList,[Ljava.lang.module.ModuleDescriptor$Provides;,java.lang.module.ModuleDescriptor$Provides,[Ljava.lang.module.ModuleDescriptor$Exports;,java.lang.module.ModuleDescriptor$Exports,[Ljava.lang.module.ModuleDescrip
 tor$Requires$Modifier;,java.lang.module.ModuleDescriptor$Requires$Modifier,[Ljava.lang.Enum;,java.lang.Enum,[Ljava.lang.module.ModuleDescriptor$Requires;,java.lang.module.ModuleDescriptor$Requires,java.util.ImmutableCollections$Set12,java.lang.module.ModuleDescriptor$Version,[Ljava.lang.module.ModuleDescriptor;,java.lang.module.ModuleDescriptor,jdk.internal.module.ModuleReferenceImpl,[Ljava.lang.module.ModuleReference;,java.lang.module.ModuleReference,java.util.ImmutableCollections$SetN,java.util.ImmutableCollections$AbstractImmutableSet,java.util.Set,java.util.ImmutableCollections$AbstractImmutableCollection,jdk.internal.module.SystemModuleFinders$SystemModuleFinder,java.lang.module.ModuleFinder,jdk.internal.module.ArchivedModuleGraph,[Lsun.util.locale.BaseLocale;,sun.util.locale.BaseLocale,java.util.ImmutableCollections$MapN,java.util.ImmutableCollections$AbstractImmutableMap,java.util.jar.Attributes$Name,java.lang.Character$CharacterCache,java.lang.Short$ShortCache,java.lang.Byte
 $ByteCache,java.lang.Long$LongCache,java.lang.Integer$IntegerCache,jdk.internal.vm.vector.VectorSupport$VectorShuffle,jdk.internal.vm.vector.VectorSupport$VectorMask,jdk.internal.vm.vector.VectorSupport$Vector,jdk.internal.vm.vector.VectorSupport$VectorPayload,jdk.internal.vm.vector.VectorSupport,java.lang.reflect.RecordComponent,java.util.Iterator,[Ljava.lang.Long;,java.lang.Long,[Ljava.lang.Integer;,java.lang.Integer,[Ljava.lang.Short;,java.lang.Short,[Ljava.lang.Byte;,java.lang.Byte,java.lang.Double,java.lang.Float,[Ljava.lang.Number;,java.lang.Number,[Ljava.lang.Character;,java.lang.Character,java.lang.Boolean,java.util.concurrent.locks.AbstractOwnableSynchronizer,java.lang.LiveStackFrameInfo,java.lang.LiveStackFrame,java.lang.StackFrameInfo,java.lang.StackWalker$StackFrame,java.lang.StackStreamFactory$AbstractStackWalker,java.lang.StackWalker,java.nio.Buffer,[Ljava.lang.StackTraceElement;,java.lang.StackTraceElement,java.util.ArrayList,java.util.RandomAccess,java.util.AbstractL
 ist,java.util.List,java.util.AbstractCollection,java.util.Collection,java.lang.Iterable,java.util.concurrent.ConcurrentHashMap,java.util.concurrent.ConcurrentMap,java.util.AbstractMap,java.security.CodeSource,jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.ClassLoaders$AppClassLoader,jdk.internal.loader.ClassLoaders,jdk.internal.loader.BuiltinClassLoader,java.util.jar.Manifest,java.net.URL,java.io.ByteArrayInputStream,java.io.InputStream,java.io.Closeable,java.lang.AutoCloseable,jdk.internal.module.Modules,jdk.internal.misc.Unsafe,jdk.internal.misc.UnsafeConstants,java.lang.StringBuilder,java.lang.StringBuffer,java.lang.AbstractStringBuilder,java.lang.Appendable,java.lang.AssertionStatusDirectives,java.lang.invoke.VolatileCallSite,java.lang.invoke.MutableCallSite,java.lang.invoke.ConstantCallSite,java.lang.invoke.MethodHandleNatives$CallSiteContext,jdk.internal.invoke.NativeEntryPoint,java.lang.invoke.CallSite,java.lang.BootstrapMethodError,[Ljava.lang.invok
 e.MethodType;,java.lang.invoke.MethodType,[Ljava.lang.invoke.TypeDescriptor$OfMethod;,java.lang.invoke.TypeDescriptor$OfMethod,[Ljava.lang.invoke.LambdaForm;,java.lang.invoke.LambdaForm,java.lang.invoke.MethodHandleNatives,java.lang.invoke.ResolvedMethodName,java.lang.invoke.MemberName,java.lang.invoke.VarHandle,java.lang.invoke.DirectMethodHandle,[Ljava.lang.invoke.MethodHandle;,java.lang.invoke.MethodHandle,jdk.internal.reflect.NativeConstructorAccessorImpl,jdk.internal.reflect.CallerSensitive,[Ljava.lang.annotation.Annotation;,java.lang.annotation.Annotation,jdk.internal.reflect.UnsafeStaticFieldAccessorImpl,jdk.internal.reflect.UnsafeFieldAccessorImpl,jdk.internal.reflect.FieldAccessorImpl,jdk.internal.reflect.FieldAccessor,jdk.internal.reflect.ConstantPool,jdk.internal.reflect.DelegatingClassLoader,jdk.internal.reflect.ConstructorAccessorImpl,jdk.internal.reflect.ConstructorAccessor,jdk.internal.reflect.MethodAccessorImpl,jdk.internal.reflect.MethodAccessor,jdk.internal.reflect
 .MagicAccessorImpl,[Ljava.lang.reflect.Constructor;,java.lang.reflect.Constructor,[Ljava.lang.reflect.Method;,java.lang.reflect.Method,[Ljava.lang.reflect.Executable;,java.lang.reflect.Executable,java.lang.reflect.Parameter,java.lang.reflect.Field,[Ljava.lang.reflect.Member;,java.lang.reflect.Member,[Ljava.lang.reflect.AccessibleObject;,java.lang.reflect.AccessibleObject,[Ljava.lang.Module;,java.lang.Module,java.util.Properties,java.util.Hashtable,java.util.Map,java.util.Dictionary,[Ljava.lang.ThreadGroup;,java.lang.ThreadGroup,[Ljava.lang.Thread$UncaughtExceptionHandler;,java.lang.Thread$UncaughtExceptionHandler,[Ljava.lang.Thread;,java.lang.Thread,[Ljava.lang.Runnable;,java.lang.Runnable,java.lang.ref.Finalizer,java.lang.ref.PhantomReference,java.lang.ref.FinalReference,[Ljava.lang.ref.WeakReference;,java.lang.ref.WeakReference,[Ljava.lang.ref.SoftReference;,java.lang.ref.SoftReference,[Ljava.lang.ref.Reference;,java.lang.ref.Reference,java.lang.IllegalMonitorStateException,java.l
 ang.StackOverflowError,[Ljava.lang.OutOfMemoryError;,java.lang.OutOfMemoryError,java.lang.InternalError,[Ljava.lang.VirtualMachineError;,java.lang.VirtualMachineError,java.lang.ArrayStoreException,java.lang.ClassCastException,java.lang.NoClassDefFoundError,java.lang.LinkageError,java.lang.Record,java.lang.ClassNotFoundException,java.lang.ReflectiveOperationException,java.security.SecureClassLoader,java.security.AccessController,java.security.AccessControlContext,[Ljava.security.ProtectionDomain;,java.security.ProtectionDomain,java.lang.SecurityManager,java.lang.RuntimeException,java.lang.Exception,java.lang.ThreadDeath,[Ljava.lang.Error;,java.lang.Error,[Ljava.lang.Throwable;,java.lang.Throwable,java.lang.System,[Ljava.lang.ClassLoader;,java.lang.ClassLoader,[Ljava.lang.Cloneable;,java.lang.Cloneable,[Ljava.lang.Class;,java.lang.Class,[Ljava.lang.invoke.TypeDescriptor$OfField;,java.lang.invoke.TypeDescriptor$OfField,[Ljava.lang.invoke.TypeDescriptor;,java.lang.invoke.TypeDescriptor,
 [Ljava.lang.reflect.Type;,java.lang.reflect.Type,[Ljava.lang.reflect.GenericDeclaration;,java.lang.reflect.GenericDeclaration,[Ljava.lang.reflect.AnnotatedElement;,java.lang.reflect.AnnotatedElement,[Ljava.lang.String;,java.lang.String,[Ljava.lang.constant.ConstantDesc;,java.lang.constant.ConstantDesc,[Ljava.lang.constant.Constable;,java.lang.constant.Constable,[Ljava.lang.CharSequence;,java.lang.CharSequence,[Ljava.lang.Comparable;,java.lang.Comparable,[Ljava.io.Serializable;,java.io.Serializable,[[Ljava.lang.Object;,[Ljava.lang.Object;,java.lang.Object, }

>>  - packages            0x7fea482e03a0
>>  - module              0x7fea482e5030
>>  - unnamed module      0x7fea482e0b50
>>  - dictionary          0x7fea482e0bf0
>>  - jmethod count       3
>>  - deallocate list     (nil)
>
> I was just using PrintSystemDictionaryAtExit and wanted to ignore the CLDG information, which is already quite verbose for this option, so there was a lot of scrolling.
>
> It's sort of a small change to add a nonproduct PrintClassLoaderDataGraphAtExit and use that to print the CLDG at exit and remove it from PrintSystemDictionaryAtExit.  Then we can each get the info we want.

While adding the new flag PrintSystemDictionaryAtExit, I found that we may have missed acquiring CLDGraph_lock in some places.

https://github.com/openjdk/jdk/blob/177bc84fe861f93f51e6d8ab5bf0738f4009522a/src/hotspot/share/classfile/classLoaderDataGraph.cpp#L674-L676

https://github.com/openjdk/jdk/blob/177bc84fe861f93f51e6d8ab5bf0738f4009522a/src/hotspot/share/memory/universe.cpp#L1129-L1131

It seems they are neither at a safepoint nor owned the CLDGraph_lock?

Thanks!
Yang

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

Coleen Phillimore-3
On Fri, 2 Apr 2021 16:15:11 GMT, Yi Yang <[hidden email]> wrote:

>> I was just using PrintSystemDictionaryAtExit and wanted to ignore the CLDG information, which is already quite verbose for this option, so there was a lot of scrolling.
>>
>> It's sort of a small change to add a nonproduct PrintClassLoaderDataGraphAtExit and use that to print the CLDG at exit and remove it from PrintSystemDictionaryAtExit.  Then we can each get the info we want.
>
> While adding the new flag PrintSystemDictionaryAtExit, I found that we may have missed acquiring CLDGraph_lock in some places.
>
> https://github.com/openjdk/jdk/blob/177bc84fe861f93f51e6d8ab5bf0738f4009522a/src/hotspot/share/classfile/classLoaderDataGraph.cpp#L674-L676
>
> https://github.com/openjdk/jdk/blob/177bc84fe861f93f51e6d8ab5bf0738f4009522a/src/hotspot/share/memory/universe.cpp#L1129-L1131
>
> It seems they are neither at a safepoint nor owned the CLDGraph_lock?
>
> Thanks!
> Yang

Yes, I like the new option.  You're correct. There should be a CLDG_lock at both Universe::verify and debug.cpp.  The latter is only called from the debugger so I didn't know if adding the lock would break anything, the former should have the lock.  If you don't mind adding these and retesting, while waiting for your second reviewer (who might be having a holiday weekend), that would be great.  Thanks!

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

David Holmes-2
In reply to this post by Yi Yang
On Fri, 2 Apr 2021 16:12:49 GMT, Yi Yang <[hidden email]> wrote:

>> Trivial chanage to make debugging happy, now cld->print() would be:
>>
>> ClassLoaderData(0x00007ff17432b670)
>>  - name                'platform'
>>  - holder              WeakHandle: 0x00000007fef56678
>>  - class loader        0x7ff17432b828
>>  - metaspace           0x7ff17468a0b0
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          0
>>  - claim               strong
>>  - handles             43
>>  - dependency count    0
>>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>>  - packages            0x7ff17432bc20
>>  - module              0x7ff17432c520
>>  - unnamed module      0x7ff17432c3d0
>>  - dictionary          0x7ff17432c470
>>  - deallocate list     0x7ff0a4023bd0
>
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>
>   new flag PrintClassLoaderDataGraphAtExit

Hi Yi,

Approval in principle, but some changes requested, please see below.

Thanks,
David

src/hotspot/share/classfile/classLoaderData.cpp line 952:

> 950:     out->print_cr("");
> 951:   }
> 952:   out->print_cr(" - class loader        %p", _class_loader.ptr_raw());

We don't use  the %p in VM shared code as it behaves differently across platforms - use PTR_FORMAT.

src/hotspot/share/oops/method.cpp line 2260:

> 2258: void Method::print_jmethod_ids(const ClassLoaderData* loader_data, outputStream* out) {
> 2259:   out->print("%d", loader_data->jmethod_ids()->count_methods());
> 2260: }

This method is pointless if it only prints the count to the stream without any descriptive text. Just delete it and print the method count directly in the caller.

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

Changes requested by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

Yi Yang
On Tue, 6 Apr 2021 01:43:40 GMT, David Holmes <[hidden email]> wrote:

>> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>>
>>   new flag PrintClassLoaderDataGraphAtExit
>
> src/hotspot/share/oops/method.cpp line 2260:
>
>> 2258: void Method::print_jmethod_ids(const ClassLoaderData* loader_data, outputStream* out) {
>> 2259:   out->print("%d", loader_data->jmethod_ids()->count_methods());
>> 2260: }
>
> This method is pointless if it only prints the count to the stream without any descriptive text. Just delete it and print the method count directly in the caller.

The type of jmethod_ids  is JNIMethodBlock, which is declared in `method.cpp`, we have to access its internal fields via print_jmethod_ids that declared in `method.hpp`.  But if we only want to show jmethod_ids's address, then we can remove Method::print_jmethod_ids and print it directly. I'm not sure if others think jmethod_ids._count is important for their debugging, so I keep unchanged :)

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

David Holmes-2
On Tue, 6 Apr 2021 02:29:28 GMT, Yi Yang <[hidden email]> wrote:

>> src/hotspot/share/oops/method.cpp line 2260:
>>
>>> 2258: void Method::print_jmethod_ids(const ClassLoaderData* loader_data, outputStream* out) {
>>> 2259:   out->print("%d", loader_data->jmethod_ids()->count_methods());
>>> 2260: }
>>
>> This method is pointless if it only prints the count to the stream without any descriptive text. Just delete it and print the method count directly in the caller.
>
> The type of jmethod_ids  is JNIMethodBlock, which is declared in `method.cpp`, we have to access its internal fields via print_jmethod_ids that declared in `method.hpp`.  But if we only want to show jmethod_ids's address, then we can remove Method::print_jmethod_ids and print it directly. I'm not sure if others think jmethod_ids._count is important for their debugging, so I keep unchanged :)

Sorry I don't see your point. I am suggesting that this:

out->print   (" - jmethod count       ");
Method::print_jmethod_ids(this, out);
out->print_cr("");

be replaced by:

out->print_cr(" - jmethod count       %d", this->jmethod_ids()->count_methods());

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

Yi Yang
On Tue, 6 Apr 2021 03:09:57 GMT, David Holmes <[hidden email]> wrote:

>> The type of jmethod_ids  is JNIMethodBlock, which is declared in `method.cpp`, we have to access its internal fields via print_jmethod_ids that declared in `method.hpp`.  But if we only want to show jmethod_ids's address, then we can remove Method::print_jmethod_ids and print it directly. I'm not sure if others think jmethod_ids._count is important for their debugging, so I keep unchanged :)
>
> Sorry I don't see your point. I am suggesting that this:
>
> out->print   (" - jmethod count       ");
> Method::print_jmethod_ids(this, out);
> out->print_cr("");
>
> be replaced by:
>
> out->print_cr(" - jmethod count       %d", this->jmethod_ids()->count_methods());

Hi David,

I means, `count_methods()` is inaccessible from classLoaderDataGraph.cpp because `this->jmethod_ids()` is type of JNIMethodBlock, it was defined in **method.cpp**, i.e.:
// method.cpp
class JNIMethodBlock {
...
public:
int count_methods(){...}
}
In order to access count_methods, we have to add an API in method.hpp and method.cpp:
// method.cpp
class JNIMethodBlock {
...
int count_methods(){...}
}

void Method::print_jmethod_ids(JNIMethodBlock* block,...){
  block->count_methods();
  ....
}
// method.hpp
void Method::print_jmethod_ids(JNIMethodBlock* block,...);
Thanks~
Yang

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v2]

David Holmes-2
On Tue, 6 Apr 2021 03:20:08 GMT, Yi Yang <[hidden email]> wrote:

>> Sorry I don't see your point. I am suggesting that this:
>>
>> out->print   (" - jmethod count       ");
>> Method::print_jmethod_ids(this, out);
>> out->print_cr("");
>>
>> be replaced by:
>>
>> out->print_cr(" - jmethod count       %d", this->jmethod_ids()->count_methods());
>
> Hi David,
>
> I means, `count_methods()` is inaccessible from classLoaderDataGraph.cpp because `this->jmethod_ids()` is type of JNIMethodBlock, it was defined in **method.cpp**, i.e.:
> // method.cpp
> class JNIMethodBlock {
> ...
> public:
> int count_methods(){...}
> }
> In order to access count_methods, we have to add an API in method.hpp and method.cpp:
> // method.cpp
> class JNIMethodBlock {
> ...
> int count_methods(){...}
> }
>
> void Method::print_jmethod_ids(JNIMethodBlock* block,...){
>   block->count_methods();
>   ....
> }
> // method.hpp
> void Method::print_jmethod_ids(JNIMethodBlock* block,...);
> Thanks~
> Yang

Ah I see. In that case I'd suggest adding an API to get the count. If external code knows enough about jmethod_ids that it knows to print the count, then the count is worth exposing IMO. Otherwise restore the actual "jmethod count" text to the print function so it's a stand-alone print function again.
Aside: print_jmethod_ids() is badly named given it doesn't print any id's.

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

Yi Yang
In reply to this post by Yi Yang
> Trivial chanage to make debugging happy, now cld->print() would be:
>
> ClassLoaderData(0x00007ff17432b670)
>  - name                'platform'
>  - holder              WeakHandle: 0x00000007fef56678
>  - class loader        0x7ff17432b828
>  - metaspace           0x7ff17468a0b0
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          0
>  - claim               strong
>  - handles             43
>  - dependency count    0
>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>  - packages            0x7ff17432bc20
>  - module              0x7ff17432c520
>  - unnamed module      0x7ff17432c3d0
>  - dictionary          0x7ff17432c470
>  - deallocate list     0x7ff0a4023bd0

Yi Yang has updated the pull request incrementally with two additional commits since the last revision:

 - add CLDG_lock
 - use PTR_FORMAT

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3323/files
  - new: https://git.openjdk.java.net/jdk/pull/3323/files/bfb2261d..97db359e

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=01-02

  Stats: 12 lines in 4 files changed: 1 ins; 0 del; 11 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3323.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3323/head:pull/3323

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

Yi Yang
In reply to this post by Coleen Phillimore-3
On Fri, 2 Apr 2021 12:47:04 GMT, Coleen Phillimore <[hidden email]> wrote:

>> Yi Yang has updated the pull request incrementally with two additional commits since the last revision:
>>
>>  - add CLDG_lock
>>  - use PTR_FORMAT
>
> This looks nice. If you use -XX:+PrintSystemDictionaryAtExit with this change, is it pages and pages long?  Or does it look ok?  Thank you for doing this!

Thanks @coleenp @dholmes-ora for your reviews.

For @coleenp : It looks Universe::verify is already called at the safepoint.  print_loader_data_graph really misses CLDG_lock, it crashes without acquiring this lock. I've added MutexLocker for it.

For @dholmes-ora: print_jmethod_ids now renamed to print_jmethod_ids_count. In order to prevent incorrect use, I did not add an API like Method::get_jmethod_ids_count. Method:: print_jmethod_ids should be enough at present.

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

Coleen Phillimore-3
In reply to this post by Yi Yang
On Tue, 6 Apr 2021 06:38:53 GMT, Yi Yang <[hidden email]> wrote:

>> Trivial chanage to make debugging happy, now cld->print() would be:
>>
>> ClassLoaderData(0x00007ff17432b670)
>>  - name                'platform'
>>  - holder              WeakHandle: 0x00000007fef56678
>>  - class loader        0x7ff17432b828
>>  - metaspace           0x7ff17468a0b0
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          0
>>  - claim               strong
>>  - handles             43
>>  - dependency count    0
>>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>>  - packages            0x7ff17432bc20
>>  - module              0x7ff17432c520
>>  - unnamed module      0x7ff17432c3d0
>>  - dictionary          0x7ff17432c470
>>  - deallocate list     0x7ff0a4023bd0
>
> Yi Yang has updated the pull request incrementally with two additional commits since the last revision:
>
>  - add CLDG_lock
>  - use PTR_FORMAT

Marked as reviewed by coleenp (Reviewer).

src/hotspot/share/classfile/classLoaderData.cpp line 978:

> 976:   if (_jmethod_ids != NULL) {
> 977:     out->print   (" - jmethod count       ");
> 978:     Method::print_jmethod_ids_counts(this, out);

Yes, this is good. It was interesting at one point (to me) how many jmethodIds were in each CLD.

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

David Holmes-2
In reply to this post by Yi Yang
On Tue, 6 Apr 2021 06:38:53 GMT, Yi Yang <[hidden email]> wrote:

>> Trivial chanage to make debugging happy, now cld->print() would be:
>>
>> ClassLoaderData(0x00007ff17432b670)
>>  - name                'platform'
>>  - holder              WeakHandle: 0x00000007fef56678
>>  - class loader        0x7ff17432b828
>>  - metaspace           0x7ff17468a0b0
>>  - unloading           false
>>  - class mirror holder false
>>  - modified oops       true
>>  - keep alive          0
>>  - claim               strong
>>  - handles             43
>>  - dependency count    0
>>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>>  - packages            0x7ff17432bc20
>>  - module              0x7ff17432c520
>>  - unnamed module      0x7ff17432c3d0
>>  - dictionary          0x7ff17432c470
>>  - deallocate list     0x7ff0a4023bd0
>
> Yi Yang has updated the pull request incrementally with two additional commits since the last revision:
>
>  - add CLDG_lock
>  - use PTR_FORMAT

A couple of minor nits.

Thanks,
David

src/hotspot/share/classfile/classLoaderData.cpp line 952:

> 950:     out->print_cr("");
> 951:   }
> 952:   out->print_cr(" - class loader        " PTR_FORMAT, p2i(_class_loader.ptr_raw()));

I'm surprised the p2i's were added. If the values are pointers then p2i should not be needed. If using p2i then INTPTR_FORMAT is the correct format specifier to use.

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

Changes requested by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

David Holmes-2
In reply to this post by Coleen Phillimore-3
On Tue, 6 Apr 2021 14:54:58 GMT, Coleen Phillimore <[hidden email]> wrote:

>> Yi Yang has updated the pull request incrementally with two additional commits since the last revision:
>>
>>  - add CLDG_lock
>>  - use PTR_FORMAT
>
> src/hotspot/share/classfile/classLoaderData.cpp line 978:
>
>> 976:   if (_jmethod_ids != NULL) {
>> 977:     out->print   (" - jmethod count       ");
>> 978:     Method::print_jmethod_ids_counts(this, out);
>
> Yes, this is good. It was interesting at one point (to me) how many jmethodIds were in each CLD.

Okay by me too. But it should be count not counts.

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

Yi Yang
In reply to this post by David Holmes-2
On Wed, 7 Apr 2021 05:07:54 GMT, David Holmes <[hidden email]> wrote:

>> Yi Yang has updated the pull request incrementally with two additional commits since the last revision:
>>
>>  - add CLDG_lock
>>  - use PTR_FORMAT
>
> src/hotspot/share/classfile/classLoaderData.cpp line 952:
>
>> 950:     out->print_cr("");
>> 951:   }
>> 952:   out->print_cr(" - class loader        " PTR_FORMAT, p2i(_class_loader.ptr_raw()));
>
> I'm surprised the p2i's were added. If the values are pointers then p2i should not be needed. If using p2i then INTPTR_FORMAT is the correct format specifier to use.

I'm not sure the original intentions of these two macros. It looks like the definitions of PRT_FORMAT and INTPTR_FORMAT are identical:

https://github.com/openjdk/jdk/blob/c3abdc9aadc734053dbcc43d5294d5f16a0b0ce3/src/hotspot/share/utilities/globalDefinitions.hpp#L129-L132

Also I find many occurrences that using p2i while format specifier is PRT_FORMAT. If this is indeed wrong, I may fix them later.

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

PR: https://git.openjdk.java.net/jdk/pull/3323
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v3]

David Holmes
On 7/04/2021 3:30 pm, Yi Yang wrote:

> On Wed, 7 Apr 2021 05:07:54 GMT, David Holmes <[hidden email]> wrote:
>
>>> Yi Yang has updated the pull request incrementally with two additional commits since the last revision:
>>>
>>>   - add CLDG_lock
>>>   - use PTR_FORMAT
>>
>> src/hotspot/share/classfile/classLoaderData.cpp line 952:
>>
>>> 950:     out->print_cr("");
>>> 951:   }
>>> 952:   out->print_cr(" - class loader        " PTR_FORMAT, p2i(_class_loader.ptr_raw()));
>>
>> I'm surprised the p2i's were added. If the values are pointers then p2i should not be needed. If using p2i then INTPTR_FORMAT is the correct format specifier to use.
>
> I'm not sure the original intentions of these two macros. It looks like the definitions of PRT_FORMAT and INTPTR_FORMAT are identical:
>
> https://github.com/openjdk/jdk/blob/c3abdc9aadc734053dbcc43d5294d5f16a0b0ce3/src/hotspot/share/utilities/globalDefinitions.hpp#L129-L132

Yes the ultimate definitions are currently identical. The issue is about
semantic correctness: if printing a pointer type use PTR_FORMAT; if
printing an integer representation of a pointer (as provided by p2i())
then use INTPTR_FORMAT.

> Also I find many occurrences that using p2i while format specifier is PRT_FORMAT. If this is indeed wrong, I may fix them later.

Yes unfortunately there is a lot of inconsistency here. p2i was
introduced with:

http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/53a41e7cbe05

and it was a very large change. Since then, in parts of runtime at
least, we have tried to use them in a consistent way.

Thanks,
David

> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/3323
>
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264644: Add PrintClassLoaderDataGraphAtExit to print the detailed CLD graph [v4]

Yi Yang
In reply to this post by Yi Yang
> Trivial chanage to make debugging happy, now cld->print() would be:
>
> ClassLoaderData(0x00007ff17432b670)
>  - name                'platform'
>  - holder              WeakHandle: 0x00000007fef56678
>  - class loader        0x7ff17432b828
>  - metaspace           0x7ff17468a0b0
>  - unloading           false
>  - class mirror holder false
>  - modified oops       true
>  - keep alive          0
>  - claim               strong
>  - handles             43
>  - dependency count    0
>  - klasses             {java.sql.SQLFeatureNotSupportedException,java.sql.SQLNonTransientException,java.sql.SQLException,sun.util.resources.provider.NonBaseLocaleDataMetaInfo,org.ietf.jgss.GSSException,javax.sql.DataSource,java.sql.Wrapper,javax.sql.CommonDataSource,java.sql.Time,java.sql.Date,java.sql.Timestamp,sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo, }
>  - packages            0x7ff17432bc20
>  - module              0x7ff17432c520
>  - unnamed module      0x7ff17432c3d0
>  - dictionary          0x7ff17432c470
>  - deallocate list     0x7ff0a4023bd0

Yi Yang has updated the pull request incrementally with one additional commit since the last revision:

  INTPTR_FORMAT

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3323/files
  - new: https://git.openjdk.java.net/jdk/pull/3323/files/97db359e..1eb6766b

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3323&range=02-03

  Stats: 12 lines in 3 files changed: 0 ins; 0 del; 12 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3323.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3323/head:pull/3323

PR: https://git.openjdk.java.net/jdk/pull/3323
12