1211 } else { 1212 // Region nodes were visited. Continue walk up to Start or Root 1213 // to make sure that it did not walk in a cycle. 1214 met_dom = true; // first time meet 1215 iterations_without_region_limit = DominatorSearchLimit; // Reset 1216 } 1217 } 1218 if (sub->is_Start() || sub->is_Root()) { 1219 // Success if we met 'dom' along a path to Start or Root. 1220 // We assume there are no alternative paths that avoid 'dom'. 1221 // (This assumption is up to the caller to ensure!) 1222 return met_dom; 1223 } 1224 Node* up = sub->in(0); 1225 // Normalize simple pass-through regions and projections: 1226 up = sub->find_exact_control(up); 1227 // If sub == up, we found a self-loop. Try to push past it. 1228 if (sub == up && sub->is_Loop()) { 1229 // Take loop entry path on the way up to 'dom'. 1230 up = sub->in(1); // in(LoopNode::EntryControl); 1231 } else if (sub == up && sub->is_Region() && sub->req() != 3) { 1232 // Always take in(1) path on the way up to 'dom' for clone regions 1233 // (with only one input) or regions which merge > 2 paths 1234 // (usually used to merge fast/slow paths). 1235 up = sub->in(1); 1236 } else if (sub == up && sub->is_Region()) { 1237 // Try both paths for Regions with 2 input paths (it may be a loop head). 1238 // It could give conservative 'false' answer without information 1239 // which region's input is the entry path. 1240 iterations_without_region_limit = DominatorSearchLimit; // Reset 1241 1242 bool region_was_visited_before = false; 1243 // Was this Region node visited before? 1244 // If so, we have reached it because we accidentally took a 1245 // loop-back edge from 'sub' back into the body of the loop, 1246 // and worked our way up again to the loop header 'sub'. 1247 // So, take the first unexplored path on the way up to 'dom'. 1248 for (int j = nlist.size() - 1; j >= 0; j--) { 1249 intptr_t ni = (intptr_t)nlist.at(j); 1250 Node* visited = (Node*)(ni & ~1); 1251 bool visited_twice_already = ((ni & 1) != 0); 1252 if (visited == sub) { 1253 if (visited_twice_already) { 1254 // Visited 2 paths, but still stuck in loop body. Give up. 1255 return false; 1256 } | 1211 } else { 1212 // Region nodes were visited. Continue walk up to Start or Root 1213 // to make sure that it did not walk in a cycle. 1214 met_dom = true; // first time meet 1215 iterations_without_region_limit = DominatorSearchLimit; // Reset 1216 } 1217 } 1218 if (sub->is_Start() || sub->is_Root()) { 1219 // Success if we met 'dom' along a path to Start or Root. 1220 // We assume there are no alternative paths that avoid 'dom'. 1221 // (This assumption is up to the caller to ensure!) 1222 return met_dom; 1223 } 1224 Node* up = sub->in(0); 1225 // Normalize simple pass-through regions and projections: 1226 up = sub->find_exact_control(up); 1227 // If sub == up, we found a self-loop. Try to push past it. 1228 if (sub == up && sub->is_Loop()) { 1229 // Take loop entry path on the way up to 'dom'. 1230 up = sub->in(1); // in(LoopNode::EntryControl); 1231 } else if (sub == up && sub->is_Region() && sub->req() == 2) { 1232 // Take in(1) path on the way up to 'dom' for regions with only one input 1233 up = sub->in(1); 1234 } else if (sub == up && sub->is_Region() && sub->req() == 3) { 1235 // Try both paths for Regions with 2 input paths (it may be a loop head). 1236 // It could give conservative 'false' answer without information 1237 // which region's input is the entry path. 1238 iterations_without_region_limit = DominatorSearchLimit; // Reset 1239 1240 bool region_was_visited_before = false; 1241 // Was this Region node visited before? 1242 // If so, we have reached it because we accidentally took a 1243 // loop-back edge from 'sub' back into the body of the loop, 1244 // and worked our way up again to the loop header 'sub'. 1245 // So, take the first unexplored path on the way up to 'dom'. 1246 for (int j = nlist.size() - 1; j >= 0; j--) { 1247 intptr_t ni = (intptr_t)nlist.at(j); 1248 Node* visited = (Node*)(ni & ~1); 1249 bool visited_twice_already = ((ni & 1) != 0); 1250 if (visited == sub) { 1251 if (visited_twice_already) { 1252 // Visited 2 paths, but still stuck in loop body. Give up. 1253 return false; 1254 } |