Skip to content

Commit 99f33b4

Browse files
committed
8357568: IGV: Show NULL and numbers up to 4 characters in "Condense graph" filter
Reviewed-by: thartmann, mchevalier, mhaessig
1 parent a50d3be commit 99f33b4

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/hotspot/share/opto/idealGraphPrinter.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -626,12 +626,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
626626
const char *short_name = "short_name";
627627
if (strcmp(node->Name(), "Parm") == 0 && node->as_Proj()->_con >= TypeFunc::Parms) {
628628
int index = node->as_Proj()->_con - TypeFunc::Parms;
629-
if (index >= 10) {
630-
print_prop(short_name, "PA");
631-
} else {
632-
os::snprintf_checked(buffer, sizeof(buffer), "P%d", index);
633-
print_prop(short_name, buffer);
634-
}
629+
os::snprintf_checked(buffer, sizeof(buffer), "P%d", index);
630+
print_prop(short_name, buffer);
635631
} else if (strcmp(node->Name(), "IfTrue") == 0) {
636632
print_prop(short_name, "T");
637633
} else if (strcmp(node->Name(), "IfFalse") == 0) {
@@ -643,9 +639,9 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
643639
assert(typeInt->is_con(), "must be constant");
644640
jint value = typeInt->get_con();
645641

646-
// max. 2 chars allowed
647-
if (value >= -9 && value <= 99) {
648-
os::snprintf_checked(buffer, sizeof(buffer), "%d", value);
642+
// Only use up to 4 chars and fall back to a generic "I" to keep it short.
643+
int written_chars = os::snprintf_checked(buffer, sizeof(buffer), "%d", value);
644+
if (written_chars <= 4) {
649645
print_prop(short_name, buffer);
650646
} else {
651647
print_prop(short_name, "I");
@@ -657,9 +653,9 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
657653
assert(typeLong->is_con(), "must be constant");
658654
jlong value = typeLong->get_con();
659655

660-
// max. 2 chars allowed
661-
if (value >= -9 && value <= 99) {
662-
os::snprintf_checked(buffer, sizeof(buffer), JLONG_FORMAT, value);
656+
// Only use up to 4 chars and fall back to a generic "L" to keep it short.
657+
int written_chars = os::snprintf_checked(buffer, sizeof(buffer), JLONG_FORMAT, value);
658+
if (written_chars <= 4) {
663659
print_prop(short_name, buffer);
664660
} else {
665661
print_prop(short_name, "L");
@@ -676,11 +672,17 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
676672
} else if (t->base() == Type::Return_Address) {
677673
print_prop(short_name, "RA");
678674
} else if (t->base() == Type::AnyPtr) {
679-
print_prop(short_name, "P");
675+
if (t->is_ptr()->ptr() == TypePtr::Null) {
676+
print_prop(short_name, "Null");
677+
} else {
678+
print_prop(short_name, "P");
679+
}
680680
} else if (t->base() == Type::RawPtr) {
681681
print_prop(short_name, "RP");
682682
} else if (t->base() == Type::AryPtr) {
683683
print_prop(short_name, "AP");
684+
} else if (t->base() == Type::NarrowOop && t->is_narrowoop() == TypeNarrowOop::NULL_PTR) {
685+
print_prop(short_name, "Null");
684686
}
685687
}
686688

0 commit comments

Comments
 (0)