RFR: 8373615: Improve HotSpot debug functions findclass() and findmethod
Ashutosh Mehra
asmehra at openjdk.org
Fri Dec 12 20:38:52 UTC 2025
On Fri, 12 Dec 2025 16:40:24 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> I used the `findclass` and `findmethod` functions in debug.cpp a lot when debugging problems with class metadata.
>
> https://github.com/openjdk/jdk/blob/6ec36d348b1eaeedb993a905e42650242fac0918/src/hotspot/share/utilities/debug.cpp#L583-L603
>
> This REF improves these functions by:
>
> - Sorting the names of classes and methods
> - Allow "." to be used in class names. So both `findclass("java.lang.Object")` and `findclass("java/lang/Object")` would work
> - Print the C++/Java objects that represent classes and methods.
src/hotspot/share/classfile/classPrinter.cpp line 96:
> 94: return;
> 95: }
> 96: _klasses.append(InstanceKlass::cast(k));
It doesn't really matter much as these are for debugging, but it would be more efficient if filtering based on `_class_name_pattern` is done here before adding the class to the array.
src/hotspot/share/classfile/classPrinter.cpp line 164:
> 162: oop mirror = ik->java_mirror();
> 163: if (mirror != nullptr) {
> 164: _st->print("\nJava mirror oop for %s: ", ik->name()->as_C_string());
Indentation is off
src/hotspot/share/classfile/classPrinter.hpp line 56:
> 54: PRINT_METHOD_HANDLE = 1 << 4, // extra information for invokehandle
> 55: PRINT_CLASS_DETAILS = 1 << 5, // print details of the C++ and Java objects that represent classes
> 56: PRINT_METHOD_DETAILS = 1 << 6, // print details of the C++ that represent methods
Suggestion:
PRINT_METHOD_DETAILS = 1 << 6, // print details of the C++ objects that represent methods
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28796#discussion_r2615512327
PR Review Comment: https://git.openjdk.org/jdk/pull/28796#discussion_r2615512117
PR Review Comment: https://git.openjdk.org/jdk/pull/28796#discussion_r2615512521
More information about the hotspot-runtime-dev
mailing list