8339954: Print JVMCI names with the Compiler.{perfmap,codelist,CodeHeap_Analytics} diagnostic commands

Reviewed-by: phh, dnsimon
This commit is contained in:
Volker Simonis 2024-09-16 14:55:53 +00:00
parent e1ebeef040
commit 996790c70f
2 changed files with 35 additions and 8 deletions

View File

@ -1767,9 +1767,13 @@ void CodeCache::print_codelist(outputStream* st) {
nmethod* nm = iter.method();
ResourceMark rm;
char* method_name = nm->method()->name_and_sig_as_C_string();
st->print_cr("%d %d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
const char* jvmci_name = nullptr;
#if INCLUDE_JVMCI
jvmci_name = nm->jvmci_name();
#endif
st->print_cr("%d %d %d %s%s%s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
nm->compile_id(), nm->comp_level(), nm->get_state(),
method_name,
method_name, jvmci_name ? " jvmci_name=" : "", jvmci_name ? jvmci_name : "",
(intptr_t)nm->header_begin(), (intptr_t)nm->code_begin(), (intptr_t)nm->code_end());
}
}
@ -1811,12 +1815,20 @@ void CodeCache::write_perf_map(const char* filename, outputStream* st) {
while (iter.next()) {
CodeBlob *cb = iter.method();
ResourceMark rm;
const char* method_name =
cb->is_nmethod() ? cb->as_nmethod()->method()->external_name()
: cb->name();
fs.print_cr(INTPTR_FORMAT " " INTPTR_FORMAT " %s",
const char* method_name = nullptr;
const char* jvmci_name = nullptr;
if (cb->is_nmethod()) {
nmethod* nm = cb->as_nmethod();
method_name = nm->method()->external_name();
#if INCLUDE_JVMCI
jvmci_name = nm->jvmci_name();
#endif
} else {
method_name = cb->name();
}
fs.print_cr(INTPTR_FORMAT " " INTPTR_FORMAT " %s%s%s",
(intptr_t)cb->code_begin(), (intptr_t)cb->code_size(),
method_name);
method_name, jvmci_name ? " jvmci_name=" : "", jvmci_name ? jvmci_name : "");
}
}
#endif // LINUX

View File

@ -735,7 +735,16 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular
} else {
blob_name = os::strdup(cb->name());
}
#if INCLUDE_JVMCI
const char* jvmci_name = nm->jvmci_name();
if (jvmci_name != nullptr) {
size_t size = ::strlen(blob_name) + ::strlen(" jvmci_name=") + ::strlen(jvmci_name) + 1;
char* new_blob_name = (char*)os::malloc(size, mtInternal);
os::snprintf(new_blob_name, size, "%s jvmci_name=%s", blob_name, jvmci_name);
os::free((void*)blob_name);
blob_name = new_blob_name;
}
#endif
nm_size = nm->total_size();
compile_id = nm->compile_id();
comp_lvl = (CompLevel)(nm->comp_level());
@ -2184,6 +2193,12 @@ void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) {
ast->print("%s.", classNameS);
ast->print("%s", methNameS);
ast->print("%s", methSigS);
#if INCLUDE_JVMCI
const char* jvmci_name = nm->jvmci_name();
if (jvmci_name != nullptr) {
ast->print(" jvmci_name=%s", jvmci_name);
}
#endif
} else {
ast->print("%s", blob_name);
}