diff --git a/src/hotspot/share/opto/idealGraphPrinter.cpp b/src/hotspot/share/opto/idealGraphPrinter.cpp index 4b813252ff9cf..40aec858205dd 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.cpp +++ b/src/hotspot/share/opto/idealGraphPrinter.cpp @@ -509,6 +509,10 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) { print_prop("idealOpcode", (const char *)NodeClassNames[node->as_Mach()->ideal_Opcode()]); } + if (node->is_CountedLoop()) { + print_loop_kind(node->as_CountedLoop()); + } + print_field(node); buffer[0] = 0; @@ -639,6 +643,20 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) { } } +void IdealGraphPrinter::print_loop_kind(const CountedLoopNode* counted_loop) { + const char* loop_kind = nullptr; + if (counted_loop->is_pre_loop()) { + loop_kind = "pre"; + } else if (counted_loop->is_main_loop()) { + loop_kind = "main"; + } else if (counted_loop->is_post_loop()) { + loop_kind = "post"; + } + if (loop_kind != nullptr) { + print_prop("loop_kind", loop_kind); + } +} + void IdealGraphPrinter::print_bci_and_line_number(JVMState* caller) { if (caller != nullptr) { ResourceMark rm; diff --git a/src/hotspot/share/opto/idealGraphPrinter.hpp b/src/hotspot/share/opto/idealGraphPrinter.hpp index 65d7f4b547384..0997315e2d1cb 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.hpp +++ b/src/hotspot/share/opto/idealGraphPrinter.hpp @@ -34,6 +34,7 @@ #ifndef PRODUCT class Compile; +class CountedLoopNode; class PhaseIFG; class PhaseChaitin; class Matcher; @@ -124,6 +125,7 @@ class IdealGraphPrinter : public CHeapObj { IdealGraphPrinter(); ~IdealGraphPrinter(); + void print_loop_kind(const CountedLoopNode* counted_loop); public: IdealGraphPrinter(Compile* compile, const char* file_name = nullptr, bool append = false); static void clean_up(); diff --git a/src/utils/IdealGraphVisualizer/Filter/src/main/resources/com/sun/hotspot/igv/filter/helper.js b/src/utils/IdealGraphVisualizer/Filter/src/main/resources/com/sun/hotspot/igv/filter/helper.js index 78c71c0fdb079..3426e74ba4115 100644 --- a/src/utils/IdealGraphVisualizer/Filter/src/main/resources/com/sun/hotspot/igv/filter/helper.js +++ b/src/utils/IdealGraphVisualizer/Filter/src/main/resources/com/sun/hotspot/igv/filter/helper.js @@ -57,6 +57,11 @@ function hasAnyNode(selector) { return new AnySelector(selector); } +// Select the nodes for which the given property is defined. +function hasProperty(property) { + return new MatcherSelector(new Properties.InvertPropertyMatcher(new Properties.RegexpPropertyMatcher(property, ""))); +} + // Select the nodes whose given property matches a given regular expression. function matches(property, regexp) { return new MatcherSelector(new Properties.RegexpPropertyMatcher(property, regexp)); diff --git a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/customNodeInfo.filter b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/customNodeInfo.filter index 3f7956dc1ee07..7e5c14aaf5fac 100644 --- a/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/customNodeInfo.filter +++ b/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/resources/com/sun/hotspot/igv/servercompiler/filters/customNodeInfo.filter @@ -30,3 +30,8 @@ editProperty(matches("name", "CallLeaf|CallLeafNoFP"), ["dump_spec"], "extra_lab function(dump_spec) {return callLeafInfo(dump_spec[0], 1);}); editProperty(matches("name", "CallLeafDirect|CallLeafDirectVector|CallLeafNoFPDirect"), ["dump_spec"], "extra_label", function(dump_spec) {return callLeafInfo(dump_spec[0], 0);}); + +// Show pre/main/post at CountedLoopNodes. +editProperty(hasProperty("loop_kind"), ["loop_kind"], "extra_label", + function(loop_kind) { return loop_kind[0]; }); +