From 1de489e539d8d45ecbfb80a3012c5756ee30170e Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 22 May 2025 15:37:10 +0200 Subject: [PATCH 1/3] 8357568: IGV: Show NULL and numbers up to 4 characters in "Condense graph" filter --- src/hotspot/share/opto/idealGraphPrinter.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/opto/idealGraphPrinter.cpp b/src/hotspot/share/opto/idealGraphPrinter.cpp index 5154a85b0f8c1..27abefab4938b 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.cpp +++ b/src/hotspot/share/opto/idealGraphPrinter.cpp @@ -643,8 +643,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { assert(typeInt->is_con(), "must be constant"); jint value = typeInt->get_con(); - // max. 2 chars allowed - if (value >= -9 && value <= 99) { + // Only use up to 4 chars and fall back to a generic "I" to keep it short. + if (value >= -999 && value <= 9999) { os::snprintf_checked(buffer, sizeof(buffer), "%d", value); print_prop(short_name, buffer); } else { @@ -657,8 +657,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { assert(typeLong->is_con(), "must be constant"); jlong value = typeLong->get_con(); - // max. 2 chars allowed - if (value >= -9 && value <= 99) { + // Only use up to 4 chars and fall back to a generic "L" to keep it short. + if (value >= -999 && value <= 9999) { os::snprintf_checked(buffer, sizeof(buffer), JLONG_FORMAT, value); print_prop(short_name, buffer); } else { @@ -676,7 +676,11 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { } else if (t->base() == Type::Return_Address) { print_prop(short_name, "RA"); } else if (t->base() == Type::AnyPtr) { - print_prop(short_name, "P"); + if (t->is_ptr()->ptr() == TypePtr::Null) { + print_prop(short_name, "NULL"); + } else { + print_prop(short_name, "P"); + } } else if (t->base() == Type::RawPtr) { print_prop(short_name, "RP"); } else if (t->base() == Type::AryPtr) { From 4f77d003cddd98f15809566031b4c8ed645084b0 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 22 May 2025 16:38:11 +0200 Subject: [PATCH 2/3] Increase number of parameters as suggested by Manuel --- src/hotspot/share/opto/idealGraphPrinter.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/opto/idealGraphPrinter.cpp b/src/hotspot/share/opto/idealGraphPrinter.cpp index 27abefab4938b..172cff2499f15 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.cpp +++ b/src/hotspot/share/opto/idealGraphPrinter.cpp @@ -626,12 +626,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { const char *short_name = "short_name"; if (strcmp(node->Name(), "Parm") == 0 && node->as_Proj()->_con >= TypeFunc::Parms) { int index = node->as_Proj()->_con - TypeFunc::Parms; - if (index >= 10) { - print_prop(short_name, "PA"); - } else { - os::snprintf_checked(buffer, sizeof(buffer), "P%d", index); - print_prop(short_name, buffer); - } + os::snprintf_checked(buffer, sizeof(buffer), "P%d", index); + print_prop(short_name, buffer); } else if (strcmp(node->Name(), "IfTrue") == 0) { print_prop(short_name, "T"); } else if (strcmp(node->Name(), "IfFalse") == 0) { From c4381a03b5a15373d8d5fcc3f24813d38815e4f4 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Fri, 23 May 2025 10:57:37 +0200 Subject: [PATCH 3/3] better way to check nof chars, also print narrow oop null --- src/hotspot/share/opto/idealGraphPrinter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/opto/idealGraphPrinter.cpp b/src/hotspot/share/opto/idealGraphPrinter.cpp index 172cff2499f15..fe379c0c3c8a5 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.cpp +++ b/src/hotspot/share/opto/idealGraphPrinter.cpp @@ -640,8 +640,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { jint value = typeInt->get_con(); // Only use up to 4 chars and fall back to a generic "I" to keep it short. - if (value >= -999 && value <= 9999) { - os::snprintf_checked(buffer, sizeof(buffer), "%d", value); + int written_chars = os::snprintf_checked(buffer, sizeof(buffer), "%d", value); + if (written_chars <= 4) { print_prop(short_name, buffer); } else { print_prop(short_name, "I"); @@ -654,8 +654,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { jlong value = typeLong->get_con(); // Only use up to 4 chars and fall back to a generic "L" to keep it short. - if (value >= -999 && value <= 9999) { - os::snprintf_checked(buffer, sizeof(buffer), JLONG_FORMAT, value); + int written_chars = os::snprintf_checked(buffer, sizeof(buffer), JLONG_FORMAT, value); + if (written_chars <= 4) { print_prop(short_name, buffer); } else { print_prop(short_name, "L"); @@ -673,7 +673,7 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { print_prop(short_name, "RA"); } else if (t->base() == Type::AnyPtr) { if (t->is_ptr()->ptr() == TypePtr::Null) { - print_prop(short_name, "NULL"); + print_prop(short_name, "Null"); } else { print_prop(short_name, "P"); } @@ -681,6 +681,8 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) { print_prop(short_name, "RP"); } else if (t->base() == Type::AryPtr) { print_prop(short_name, "AP"); + } else if (t->base() == Type::NarrowOop && t->is_narrowoop() == TypeNarrowOop::NULL_PTR) { + print_prop(short_name, "Null"); } }