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

Yi Yang yyang at openjdk.java.net
Thu Jan 27 09:17:12 UTC 2022


On Mon, 24 Jan 2022 04:12:22 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fix test
>
> src/hotspot/share/oops/instanceKlass.cpp line 2106:
> 
>> 2104:   // classloader name
>> 2105:   ClassLoaderData* cld = k->class_loader_data();
>> 2106:   _st->print("%-12s  ", cld->loader_name());
> 
> For custom class loaders, this will likely print a long class name that will over the 12 character limit, making the output somewhat hard to read.
> 
> 
> 
> const char* ClassLoaderData::loader_name() const {
>    if (_class_loader_klass == NULL) {
>      return BOOTSTRAP_LOADER_NAME;
>    } else if (_name != NULL) {
>      return _name->as_C_string();
>    } else {
>      return _class_loader_klass->external_name();
>    }
> }
> 
> 
> Also, for custom loaders, printing out just the name of the loader class is not sufficient, as multiple loader instances may have the same type.
> 
> Maybe we should just remove line 2106? If the user wants to know the class loader, they can use the "-verbose" option of this jcmd.

Thanks for review! All comments are addressed.

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

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


More information about the serviceability-dev mailing list