Skip to content

Commit

Permalink
8343296: IGV: Show pre/main/post at CountedLoopNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
chhagedorn committed Oct 30, 2024
1 parent 63c19d3 commit d29b67f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/hotspot/share/opto/idealGraphPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/opto/idealGraphPrinter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#ifndef PRODUCT

class Compile;
class CountedLoopNode;
class PhaseIFG;
class PhaseChaitin;
class Matcher;
Expand Down Expand Up @@ -124,6 +125,7 @@ class IdealGraphPrinter : public CHeapObj<mtCompiler> {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]; });

0 comments on commit d29b67f

Please sign in to comment.