RFR: 8327246: Add a jcmd diagnostic command to list the jar files loaded by a process [v2]
David Holmes
dholmes at openjdk.org
Wed Jan 7 00:05:18 UTC 2026
On Tue, 6 Jan 2026 21:29:36 GMT, Larry Cable <duke at openjdk.org> wrote:
>> modified the pre-existing VM.classes jcmd to add a 'location' option, that when specified, will (natively) attempt to obtain the value (if non-null) of the location URL of the CodeSource of each classes ProtectionDomain.
>>
>> effectively:
>>
>> someObject.getClass().getProtectionDomain().getCodeSource().getLocation().toExternalForm()
>>
>> (where interim oops are null-checked)
>
> Larry Cable has updated the pull request incrementally with one additional commit since the last revision:
>
> JDK-8327246: updated copyright year. fixed Capitialization nit and restructured use of InstanceKlass local as per comments
Overall approach seems reasonable. I have a couple of queries.
Thanks
src/hotspot/share/oops/instanceKlass.cpp line 2359:
> 2357: // initialization state
> 2358:
> 2359: InstanceKlass *ik = k->is_instance_klass() ? InstanceKlass::cast(k) : nullptr;
Suggestion:
InstanceKlass* ik = k->is_instance_klass() ? InstanceKlass::cast(k) : nullptr;
src/hotspot/share/oops/instanceKlass.cpp line 2386:
> 2384: oop pd = java_lang_Class::protection_domain(k->java_mirror());
> 2385:
> 2386: if (pd != nullptr && (ik = pd->klass()->is_instance_klass() ? InstanceKlass::cast(pd->klass()) : nullptr) != nullptr) {
Is a non-instance-class possible here??
src/hotspot/share/oops/instanceKlass.cpp line 2397:
> 2395: oop cs = pd->obj_field(csfd.offset());
> 2396:
> 2397: if (cs != nullptr && (ik = cs->klass()->is_instance_klass() ? InstanceKlass::cast(cs->klass()) : nullptr) != nullptr) {
Is a non-instance-class possible here??
src/hotspot/share/oops/instanceKlass.cpp line 2406:
> 2404: oop loc = cs->obj_field(locfd.offset());
> 2405:
> 2406: if (loc != nullptr && loc->klass() == vmClasses::String_klass()) {
Why are you checking the class type?
-------------
PR Review: https://git.openjdk.org/jdk/pull/29048#pullrequestreview-3632862000
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2666611656
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2666619018
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2666619778
PR Review Comment: https://git.openjdk.org/jdk/pull/29048#discussion_r2666626257
More information about the hotspot-dev
mailing list