On Mon, 8 Jun 2026 14:40:55 GMT, Kevin Walls <[email protected]> wrote:
> Add a "-location" option to jcmd VM.classes which will show the URL of the > class if possible. e.g. > > > 769483: > KlassAddr Size State Flags ClassName > 0x0000000055040400 71 fully_initialized W MyApp$1 > "file:///my/progs/" > 0x0000000055040000 67 fully_initialized W MyApp > "file:///my/progs/" > 0x0000000055005800 73 fully_initialized W > jdk.internal.event.ThreadSleepEvent > 0x0000000055005400 73 allocated > jdk.internal.event.ThreadSleepEvent > ... > > (Fixing a column width for the ClassName seems impossible as it can be really > long, so URL is simply printed after ClassName.) > > > This is a continuation of https://git.openjdk.org/jdk/pull/29048 which was > pretty far along and this is a simple import. > A few minor changes in help text, (C), and of course whitespace. > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/hotspot/share/services/diagnosticCommand.cpp line 975: > 973: _out->print_cr("\n%d classes shared from static cache: %s", > closure._aot_statics, FileMapInfo::current_info()->full_path()); > 974: if (closure._aot_dynamics > 0) > 975: _out->print_cr("\n%d classes shared from dynamic cache: %s", > closure._aot_dynamics, FileMapInfo::dynamic_info()->full_path()); Suggestion: if (closure._aot_statics > 0) { _out->print_cr(); _out->print_cr("%d classes shared from static cache: %s", closure._aot_statics, FileMapInfo::current_info()->full_path()); } if (closure._aot_dynamics > 0) { _out->print_cr(); _out->print_cr("%d classes shared from dynamic cache: %s", closure._aot_dynamics, FileMapInfo::dynamic_info()->full_path()); } src/hotspot/share/services/diagnosticCommand.hpp line 748: > 746: class ClassesDCmd : public DCmdWithParser { > 747: private: > 748: static constexpr const char *desc = "Print all loaded > classes.\nClasses are annotated with flags:\n F = has, or inherits, a > non-empty finalize method,\n f = has final method,\n W = methods rewritten,\n > C = marked with @Contended annotation,\n R = has been redefined,\n S = is an > (App)CDS shared class,\n (if -location is specified, append: 's' (static) > or 'd' (dynamic) for AOT cache location)"; It might be better if we write like here document: Suggestion: static constexpr const char *desc = "Print all loaded classes.\n "Classes are annotated with flags:\n" " F = has, or inherits, a non-empty finalize method,\n" " f = has final method,\n W = methods rewritten,\n" " C = marked with @Contended annotation,\n" " R = has been redefined,\n" " S = is an (App)CDS shared class,\n" " (if -location is specified, append: 's' (static) or 'd' (dynamic) for AOT cache location)"; src/hotspot/share/services/diagnosticCommand.hpp line 760: > 758: } > 759: static const char* description() { > 760: return desc; It is ok to write string literal here instead of defining `desc` . src/jdk.jcmd/share/man/jcmd.md line 811: > 809: - `C` = marked with `@Contended` annotation, > 810: - `R` = has been redefined, > 811: - `S` = is shared class (if `-location` is specified then either > 's' (static) or 'd' (dynamic) for AOT cache origin is appended) Should we align it with the description in diagnosticCommand.hpp? S = is an (App)CDS shared class,\n (if -location is specified, append: 's' (static) or 'd' (dynamic) for AOT cache location)" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31420#discussion_r3379022027 PR Review Comment: https://git.openjdk.org/jdk/pull/31420#discussion_r3379041229 PR Review Comment: https://git.openjdk.org/jdk/pull/31420#discussion_r3379057066 PR Review Comment: https://git.openjdk.org/jdk/pull/31420#discussion_r3379084214
