Skip to content

Commit cfab88b

Browse files
committed
8351256: Improve printing of runtime call stub names in disassember output
Reviewed-by: kvn
1 parent 7a5acb9 commit cfab88b

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

src/hotspot/share/code/nmethod.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3550,7 +3550,10 @@ const char* nmethod::reloc_string_for(u_char* begin, u_char* end) {
35503550
while (iter.next()) {
35513551
have_one = true;
35523552
switch (iter.type()) {
3553-
case relocInfo::none: return "no_reloc";
3553+
case relocInfo::none: {
3554+
// Skip it and check next
3555+
break;
3556+
}
35543557
case relocInfo::oop_type: {
35553558
// Get a non-resizable resource-allocated stringStream.
35563559
// Our callees make use of (nested) ResourceMarks.
@@ -3579,6 +3582,16 @@ const char* nmethod::reloc_string_for(u_char* begin, u_char* end) {
35793582
st.print("runtime_call");
35803583
CallRelocation* r = (CallRelocation*)iter.reloc();
35813584
address dest = r->destination();
3585+
if (StubRoutines::contains(dest)) {
3586+
StubCodeDesc* desc = StubCodeDesc::desc_for(dest);
3587+
if (desc == nullptr) {
3588+
desc = StubCodeDesc::desc_for(dest + frame::pc_return_offset);
3589+
}
3590+
if (desc != nullptr) {
3591+
st.print(" Stub::%s", desc->name());
3592+
return st.as_string();
3593+
}
3594+
}
35823595
CodeBlob* cb = CodeCache::find_blob(dest);
35833596
if (cb != nullptr) {
35843597
st.print(" %s", cb->name());

src/hotspot/share/code/relocInfo.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,20 +869,54 @@ void RelocIterator::print_current() {
869869
static_call_Relocation* r = (static_call_Relocation*) reloc();
870870
tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
871871
p2i(r->destination()), p2i(r->method_value()));
872+
CodeBlob* cb = CodeCache::find_blob(r->destination());
873+
if (cb != nullptr) {
874+
tty->print(" Blob::%s", cb->name());
875+
}
872876
break;
873877
}
874878
case relocInfo::runtime_call_type:
875879
case relocInfo::runtime_call_w_cp_type:
876880
{
877881
CallRelocation* r = (CallRelocation*) reloc();
878-
tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
882+
address dest = r->destination();
883+
tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(dest));
884+
if (StubRoutines::contains(dest)) {
885+
StubCodeDesc* desc = StubCodeDesc::desc_for(dest);
886+
if (desc == nullptr) {
887+
desc = StubCodeDesc::desc_for(dest + frame::pc_return_offset);
888+
}
889+
if (desc != nullptr) {
890+
tty->print(" Stub::%s", desc->name());
891+
}
892+
} else {
893+
CodeBlob* cb = CodeCache::find_blob(dest);
894+
if (cb != nullptr) {
895+
tty->print(" %s", cb->name());
896+
} else {
897+
ResourceMark rm;
898+
const int buflen = 1024;
899+
char* buf = NEW_RESOURCE_ARRAY(char, buflen);
900+
int offset;
901+
if (os::dll_address_to_function_name(dest, buf, buflen, &offset)) {
902+
tty->print(" %s", buf);
903+
if (offset != 0) {
904+
tty->print("+%d", offset);
905+
}
906+
}
907+
}
908+
}
879909
break;
880910
}
881911
case relocInfo::virtual_call_type:
882912
{
883913
virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
884914
tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
885915
p2i(r->destination()), p2i(r->cached_value()), p2i(r->method_value()));
916+
CodeBlob* cb = CodeCache::find_blob(r->destination());
917+
if (cb != nullptr) {
918+
tty->print(" Blob::%s", cb->name());
919+
}
886920
break;
887921
}
888922
case relocInfo::static_stub_type:
@@ -902,6 +936,10 @@ void RelocIterator::print_current() {
902936
opt_virtual_call_Relocation* r = (opt_virtual_call_Relocation*) reloc();
903937
tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
904938
p2i(r->destination()), p2i(r->method_value()));
939+
CodeBlob* cb = CodeCache::find_blob(r->destination());
940+
if (cb != nullptr) {
941+
tty->print(" Blob::%s", cb->name());
942+
}
905943
break;
906944
}
907945
default:

0 commit comments

Comments
 (0)