305 Block* mid = worklist.pop(); |
305 Block* mid = worklist.pop(); |
306 if (mid == early) continue; // stop searching here |
306 if (mid == early) continue; // stop searching here |
307 |
307 |
308 // Test and set the visited bit. |
308 // Test and set the visited bit. |
309 if (mid->raise_LCA_visited() == mark) continue; // already visited |
309 if (mid->raise_LCA_visited() == mark) continue; // already visited |
310 mid->set_raise_LCA_visited(mark); |
|
311 |
310 |
312 // Don't process the current LCA, otherwise the search may terminate early |
311 // Don't process the current LCA, otherwise the search may terminate early |
313 if (mid != LCA && mid->raise_LCA_mark() == mark) { |
312 if (mid != LCA && mid->raise_LCA_mark() == mark) { |
314 // Raise the LCA. |
313 // Raise the LCA. |
315 LCA = mid->dom_lca(LCA); |
314 LCA = mid->dom_lca(LCA); |
316 if (LCA == early) break; // stop searching everywhere |
315 if (LCA == early) break; // stop searching everywhere |
317 assert(early->dominates(LCA), "early is high enough"); |
316 assert(early->dominates(LCA), "early is high enough"); |
318 // Resume searching at that point, skipping intermediate levels. |
317 // Resume searching at that point, skipping intermediate levels. |
319 worklist.push(LCA); |
318 worklist.push(LCA); |
|
319 if (LCA == mid) |
|
320 continue; // Don't mark as visited to avoid early termination. |
320 } else { |
321 } else { |
321 // Keep searching through this block's predecessors. |
322 // Keep searching through this block's predecessors. |
322 for (uint j = 1, jmax = mid->num_preds(); j < jmax; j++) { |
323 for (uint j = 1, jmax = mid->num_preds(); j < jmax; j++) { |
323 Block* mid_parent = bbs[ mid->pred(j)->_idx ]; |
324 Block* mid_parent = bbs[ mid->pred(j)->_idx ]; |
324 worklist.push(mid_parent); |
325 worklist.push(mid_parent); |
325 } |
326 } |
326 } |
327 } |
|
328 mid->set_raise_LCA_visited(mark); |
327 } |
329 } |
328 return LCA; |
330 return LCA; |
329 } |
331 } |
330 |
332 |
331 //--------------------------memory_early_block-------------------------------- |
333 //--------------------------memory_early_block-------------------------------- |