Skip to content

Commit 8345803

Browse files
simonispull[bot]
authored andcommitted
8339954: Print JVMCI names with the Compiler.{perfmap,codelist,CodeHeap_Analytics} diagnostic commands
Reviewed-by: phh, dnsimon
1 parent 088b81c commit 8345803

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

src/hotspot/share/code/codeCache.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,13 @@ void CodeCache::print_codelist(outputStream* st) {
17671767
nmethod* nm = iter.method();
17681768
ResourceMark rm;
17691769
char* method_name = nm->method()->name_and_sig_as_C_string();
1770-
st->print_cr("%d %d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
1770+
const char* jvmci_name = nullptr;
1771+
#if INCLUDE_JVMCI
1772+
jvmci_name = nm->jvmci_name();
1773+
#endif
1774+
st->print_cr("%d %d %d %s%s%s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
17711775
nm->compile_id(), nm->comp_level(), nm->get_state(),
1772-
method_name,
1776+
method_name, jvmci_name ? " jvmci_name=" : "", jvmci_name ? jvmci_name : "",
17731777
(intptr_t)nm->header_begin(), (intptr_t)nm->code_begin(), (intptr_t)nm->code_end());
17741778
}
17751779
}
@@ -1811,12 +1815,20 @@ void CodeCache::write_perf_map(const char* filename, outputStream* st) {
18111815
while (iter.next()) {
18121816
CodeBlob *cb = iter.method();
18131817
ResourceMark rm;
1814-
const char* method_name =
1815-
cb->is_nmethod() ? cb->as_nmethod()->method()->external_name()
1816-
: cb->name();
1817-
fs.print_cr(INTPTR_FORMAT " " INTPTR_FORMAT " %s",
1818+
const char* method_name = nullptr;
1819+
const char* jvmci_name = nullptr;
1820+
if (cb->is_nmethod()) {
1821+
nmethod* nm = cb->as_nmethod();
1822+
method_name = nm->method()->external_name();
1823+
#if INCLUDE_JVMCI
1824+
jvmci_name = nm->jvmci_name();
1825+
#endif
1826+
} else {
1827+
method_name = cb->name();
1828+
}
1829+
fs.print_cr(INTPTR_FORMAT " " INTPTR_FORMAT " %s%s%s",
18181830
(intptr_t)cb->code_begin(), (intptr_t)cb->code_size(),
1819-
method_name);
1831+
method_name, jvmci_name ? " jvmci_name=" : "", jvmci_name ? jvmci_name : "");
18201832
}
18211833
}
18221834
#endif // LINUX

src/hotspot/share/code/codeHeapState.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,16 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular
735735
} else {
736736
blob_name = os::strdup(cb->name());
737737
}
738-
738+
#if INCLUDE_JVMCI
739+
const char* jvmci_name = nm->jvmci_name();
740+
if (jvmci_name != nullptr) {
741+
size_t size = ::strlen(blob_name) + ::strlen(" jvmci_name=") + ::strlen(jvmci_name) + 1;
742+
char* new_blob_name = (char*)os::malloc(size, mtInternal);
743+
os::snprintf(new_blob_name, size, "%s jvmci_name=%s", blob_name, jvmci_name);
744+
os::free((void*)blob_name);
745+
blob_name = new_blob_name;
746+
}
747+
#endif
739748
nm_size = nm->total_size();
740749
compile_id = nm->compile_id();
741750
comp_lvl = (CompLevel)(nm->comp_level());
@@ -2184,6 +2193,12 @@ void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) {
21842193
ast->print("%s.", classNameS);
21852194
ast->print("%s", methNameS);
21862195
ast->print("%s", methSigS);
2196+
#if INCLUDE_JVMCI
2197+
const char* jvmci_name = nm->jvmci_name();
2198+
if (jvmci_name != nullptr) {
2199+
ast->print(" jvmci_name=%s", jvmci_name);
2200+
}
2201+
#endif
21872202
} else {
21882203
ast->print("%s", blob_name);
21892204
}

0 commit comments

Comments
 (0)