1.1 --- a/src/share/vm/opto/node.cpp Thu May 15 22:40:43 2008 -0700 1.2 +++ b/src/share/vm/opto/node.cpp Thu May 15 22:43:11 2008 -0700 1.3 @@ -1043,6 +1043,9 @@ 1.4 assert(this->is_CFG(), "expecting control"); 1.5 assert(sub != NULL && sub->is_CFG(), "expecting control"); 1.6 1.7 + // detect dead cycle without regions 1.8 + int iterations_without_region_limit = DominatorSearchLimit; 1.9 + 1.10 Node* orig_sub = sub; 1.11 nlist.clear(); 1.12 bool this_dominates = false; 1.13 @@ -1057,6 +1060,7 @@ 1.14 // Region nodes were visited. Continue walk up to Start or Root 1.15 // to make sure that it did not walk in a cycle. 1.16 this_dominates = true; // first time meet 1.17 + iterations_without_region_limit = DominatorSearchLimit; // Reset 1.18 } else { 1.19 return false; // already met before: walk in a cycle 1.20 } 1.21 @@ -1069,19 +1073,20 @@ 1.22 return false; // Conservative answer for dead code 1.23 1.24 if (sub == up && sub->is_Loop()) { 1.25 - up = sub->in(0); // in(LoopNode::EntryControl); 1.26 - } else if (sub == up && sub->is_Region()) { 1.27 + up = sub->in(1); // in(LoopNode::EntryControl); 1.28 + } else if (sub == up && sub->is_Region() && sub->req() == 3) { 1.29 + iterations_without_region_limit = DominatorSearchLimit; // Reset 1.30 uint i = 1; 1.31 - if (nlist.size() == 0) { 1.32 + uint size = nlist.size(); 1.33 + if (size == 0) { 1.34 // No Region nodes (except Loops) were visited before. 1.35 // Take first valid path on the way up to 'this'. 1.36 - } else if (nlist.at(nlist.size() - 1) == sub) { 1.37 + } else if (nlist.at(size - 1) == sub) { 1.38 // This Region node was just visited. Take other path. 1.39 i = region_input + 1; 1.40 nlist.pop(); 1.41 } else { 1.42 // Was this Region node visited before? 1.43 - uint size = nlist.size(); 1.44 for (uint j = 0; j < size; j++) { 1.45 if (nlist.at(j) == sub) { 1.46 return false; // The Region node was visited before. Give up. 1.47 @@ -1104,8 +1109,9 @@ 1.48 } 1.49 if (sub == up) 1.50 return false; // some kind of tight cycle 1.51 - if (orig_sub == up) 1.52 - return false; // walk in a cycle 1.53 + 1.54 + if (--iterations_without_region_limit < 0) 1.55 + return false; // dead cycle 1.56 1.57 sub = up; 1.58 }