1.1 --- a/src/share/vm/opto/node.cpp Sat Mar 26 08:31:45 2011 -0700 1.2 +++ b/src/share/vm/opto/node.cpp Sun Mar 27 00:00:14 2011 -0700 1.3 @@ -1373,12 +1373,12 @@ 1.4 //------------------------------find------------------------------------------ 1.5 // Find a neighbor of this Node with the given _idx 1.6 // If idx is negative, find its absolute value, following both _in and _out. 1.7 -static void find_recur( Node* &result, Node *n, int idx, bool only_ctrl, 1.8 - VectorSet &old_space, VectorSet &new_space ) { 1.9 +static void find_recur(Compile* C, Node* &result, Node *n, int idx, bool only_ctrl, 1.10 + VectorSet* old_space, VectorSet* new_space ) { 1.11 int node_idx = (idx >= 0) ? idx : -idx; 1.12 if (NotANode(n)) return; // Gracefully handle NULL, -1, 0xabababab, etc. 1.13 - // Contained in new_space or old_space? 1.14 - VectorSet *v = Compile::current()->node_arena()->contains(n) ? &new_space : &old_space; 1.15 + // Contained in new_space or old_space? Check old_arena first since it's mostly empty. 1.16 + VectorSet *v = C->old_arena()->contains(n) ? old_space : new_space; 1.17 if( v->test(n->_idx) ) return; 1.18 if( (int)n->_idx == node_idx 1.19 debug_only(|| n->debug_idx() == node_idx) ) { 1.20 @@ -1390,19 +1390,23 @@ 1.21 v->set(n->_idx); 1.22 for( uint i=0; i<n->len(); i++ ) { 1.23 if( only_ctrl && !(n->is_Region()) && (n->Opcode() != Op_Root) && (i != TypeFunc::Control) ) continue; 1.24 - find_recur( result, n->in(i), idx, only_ctrl, old_space, new_space ); 1.25 + find_recur(C, result, n->in(i), idx, only_ctrl, old_space, new_space ); 1.26 } 1.27 // Search along forward edges also: 1.28 if (idx < 0 && !only_ctrl) { 1.29 for( uint j=0; j<n->outcnt(); j++ ) { 1.30 - find_recur( result, n->raw_out(j), idx, only_ctrl, old_space, new_space ); 1.31 + find_recur(C, result, n->raw_out(j), idx, only_ctrl, old_space, new_space ); 1.32 } 1.33 } 1.34 #ifdef ASSERT 1.35 - // Search along debug_orig edges last: 1.36 - for (Node* orig = n->debug_orig(); orig != NULL && n != orig; orig = orig->debug_orig()) { 1.37 - if (NotANode(orig)) break; 1.38 - find_recur( result, orig, idx, only_ctrl, old_space, new_space ); 1.39 + // Search along debug_orig edges last, checking for cycles 1.40 + Node* orig = n->debug_orig(); 1.41 + if (orig != NULL) { 1.42 + do { 1.43 + if (NotANode(orig)) break; 1.44 + find_recur(C, result, orig, idx, only_ctrl, old_space, new_space ); 1.45 + orig = orig->debug_orig(); 1.46 + } while (orig != NULL && orig != n->debug_orig()); 1.47 } 1.48 #endif //ASSERT 1.49 } 1.50 @@ -1417,7 +1421,7 @@ 1.51 ResourceArea *area = Thread::current()->resource_area(); 1.52 VectorSet old_space(area), new_space(area); 1.53 Node* result = NULL; 1.54 - find_recur( result, (Node*) this, idx, false, old_space, new_space ); 1.55 + find_recur(Compile::current(), result, (Node*) this, idx, false, &old_space, &new_space ); 1.56 return result; 1.57 } 1.58 1.59 @@ -1427,7 +1431,7 @@ 1.60 ResourceArea *area = Thread::current()->resource_area(); 1.61 VectorSet old_space(area), new_space(area); 1.62 Node* result = NULL; 1.63 - find_recur( result, (Node*) this, idx, true, old_space, new_space ); 1.64 + find_recur(Compile::current(), result, (Node*) this, idx, true, &old_space, &new_space ); 1.65 return result; 1.66 } 1.67 #endif