@@ -731,10 +731,9 @@ Node* IdealGraphPrinter::get_load_node(const Node* node) {
731731
732732void 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