Skip to content

Commit

Permalink
8294356: IGV: scheduled graphs contain duplicated elements
Browse files Browse the repository at this point in the history
Reviewed-by: chagedorn, thartmann
  • Loading branch information
robcasloz committed Oct 11, 2022
1 parent 5e05e42 commit 97f1321
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/hotspot/share/opto/idealGraphPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,9 @@ Node* IdealGraphPrinter::get_load_node(const Node* node) {

void IdealGraphPrinter::walk_nodes(Node* start, bool edges, VectorSet* temp_set) {
VectorSet visited;
GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, NULL);
GrowableArray<Node *> nodeStack(Thread::current()->resource_area(), 0, 0, nullptr);
nodeStack.push(start);
visited.test_set(start->_idx);
if (C->cfg() != NULL) {
if (C->cfg() != nullptr) {
// once we have a CFG there are some nodes that aren't really
// reachable but are in the CFG so add them here.
for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {
Expand All @@ -745,25 +744,23 @@ void IdealGraphPrinter::walk_nodes(Node* start, bool edges, VectorSet* temp_set)
}
}

while(nodeStack.length() > 0) {
while (nodeStack.length() > 0) {
Node* n = nodeStack.pop();
if (visited.test_set(n->_idx)) {
continue;
}

Node *n = nodeStack.pop();
visit_node(n, edges, temp_set);

if (_traverse_outs) {
for (DUIterator i = n->outs(); n->has_out(i); i++) {
Node* p = n->out(i);
if (!visited.test_set(p->_idx)) {
nodeStack.push(p);
}
nodeStack.push(n->out(i));
}
}

for ( uint i = 0; i < n->len(); i++ ) {
if ( n->in(i) ) {
if (!visited.test_set(n->in(i)->_idx)) {
nodeStack.push(n->in(i));
}
for (uint i = 0; i < n->len(); i++) {
if (n->in(i) != nullptr) {
nodeStack.push(n->in(i));
}
}
}
Expand Down

1 comment on commit 97f1321

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.