Skip to content

Commit 97f1321

Browse files
committed
8294356: IGV: scheduled graphs contain duplicated elements
Reviewed-by: chagedorn, thartmann
1 parent 5e05e42 commit 97f1321

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/hotspot/share/opto/idealGraphPrinter.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -731,10 +731,9 @@ Node* IdealGraphPrinter::get_load_node(const Node* node) {
731731

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

748-
while(nodeStack.length() > 0) {
747+
while (nodeStack.length() > 0) {
748+
Node* n = nodeStack.pop();
749+
if (visited.test_set(n->_idx)) {
750+
continue;
751+
}
749752

750-
Node *n = nodeStack.pop();
751753
visit_node(n, edges, temp_set);
752754

753755
if (_traverse_outs) {
754756
for (DUIterator i = n->outs(); n->has_out(i); i++) {
755-
Node* p = n->out(i);
756-
if (!visited.test_set(p->_idx)) {
757-
nodeStack.push(p);
758-
}
757+
nodeStack.push(n->out(i));
759758
}
760759
}
761760

762-
for ( uint i = 0; i < n->len(); i++ ) {
763-
if ( n->in(i) ) {
764-
if (!visited.test_set(n->in(i)->_idx)) {
765-
nodeStack.push(n->in(i));
766-
}
761+
for (uint i = 0; i < n->len(); i++) {
762+
if (n->in(i) != nullptr) {
763+
nodeStack.push(n->in(i));
767764
}
768765
}
769766
}

0 commit comments

Comments
 (0)