290 }
291 return LCA;
292 }
293
294 //----------------------------raise_LCA_above_marks----------------------------
295 // Return a new LCA that dominates LCA and any of its marked predecessors.
296 // Search all my parents up to 'early' (exclusive), looking for predecessors
297 // which are marked with the given index. Return the LCA (in the dom tree)
298 // of all marked blocks. If there are none marked, return the original
299 // LCA.
300 static Block* raise_LCA_above_marks(Block* LCA, node_idx_t mark,
301 Block* early, Block_Array &bbs) {
302 Block_List worklist;
303 worklist.push(LCA);
304 while (worklist.size() > 0) {
305 Block* mid = worklist.pop();
306 if (mid == early) continue; // stop searching here
307
308 // Test and set the visited bit.
309 if (mid->raise_LCA_visited() == mark) continue; // already visited
310 mid->set_raise_LCA_visited(mark);
311
312 // Don't process the current LCA, otherwise the search may terminate early
313 if (mid != LCA && mid->raise_LCA_mark() == mark) {
314 // Raise the LCA.
315 LCA = mid->dom_lca(LCA);
316 if (LCA == early) break; // stop searching everywhere
317 assert(early->dominates(LCA), "early is high enough");
318 // Resume searching at that point, skipping intermediate levels.
319 worklist.push(LCA);
320 } else {
321 // Keep searching through this block's predecessors.
322 for (uint j = 1, jmax = mid->num_preds(); j < jmax; j++) {
323 Block* mid_parent = bbs[ mid->pred(j)->_idx ];
324 worklist.push(mid_parent);
325 }
326 }
327 }
328 return LCA;
329 }
330
331 //--------------------------memory_early_block--------------------------------
332 // This is a variation of find_deepest_input, the heart of schedule_early.
333 // Find the "early" block for a load, if we considered only memory and
334 // address inputs, that is, if other data inputs were ignored.
335 //
336 // Because a subset of edges are considered, the resulting block will
337 // be earlier (at a shallower dom_depth) than the true schedule_early
338 // point of the node. We compute this earlier block as a more permissive
339 // site for anti-dependency insertion, but only if subsume_loads is enabled.
340 static Block* memory_early_block(Node* load, Block* early, Block_Array &bbs) {
341 Node* base;
342 Node* index;
343 Node* store = load->in(MemNode::Memory);
344 load->as_Mach()->memory_inputs(base, index);
345
346 assert(base != NodeSentinel && index != NodeSentinel,
|
290 }
291 return LCA;
292 }
293
294 //----------------------------raise_LCA_above_marks----------------------------
295 // Return a new LCA that dominates LCA and any of its marked predecessors.
296 // Search all my parents up to 'early' (exclusive), looking for predecessors
297 // which are marked with the given index. Return the LCA (in the dom tree)
298 // of all marked blocks. If there are none marked, return the original
299 // LCA.
300 static Block* raise_LCA_above_marks(Block* LCA, node_idx_t mark,
301 Block* early, Block_Array &bbs) {
302 Block_List worklist;
303 worklist.push(LCA);
304 while (worklist.size() > 0) {
305 Block* mid = worklist.pop();
306 if (mid == early) continue; // stop searching here
307
308 // Test and set the visited bit.
309 if (mid->raise_LCA_visited() == mark) continue; // already visited
310
311 // Don't process the current LCA, otherwise the search may terminate early
312 if (mid != LCA && mid->raise_LCA_mark() == mark) {
313 // Raise the LCA.
314 LCA = mid->dom_lca(LCA);
315 if (LCA == early) break; // stop searching everywhere
316 assert(early->dominates(LCA), "early is high enough");
317 // Resume searching at that point, skipping intermediate levels.
318 worklist.push(LCA);
319 if (LCA == mid)
320 continue; // Don't mark as visited to avoid early termination.
321 } else {
322 // Keep searching through this block's predecessors.
323 for (uint j = 1, jmax = mid->num_preds(); j < jmax; j++) {
324 Block* mid_parent = bbs[ mid->pred(j)->_idx ];
325 worklist.push(mid_parent);
326 }
327 }
328 mid->set_raise_LCA_visited(mark);
329 }
330 return LCA;
331 }
332
333 //--------------------------memory_early_block--------------------------------
334 // This is a variation of find_deepest_input, the heart of schedule_early.
335 // Find the "early" block for a load, if we considered only memory and
336 // address inputs, that is, if other data inputs were ignored.
337 //
338 // Because a subset of edges are considered, the resulting block will
339 // be earlier (at a shallower dom_depth) than the true schedule_early
340 // point of the node. We compute this earlier block as a more permissive
341 // site for anti-dependency insertion, but only if subsume_loads is enabled.
342 static Block* memory_early_block(Node* load, Block* early, Block_Array &bbs) {
343 Node* base;
344 Node* index;
345 Node* store = load->in(MemNode::Memory);
346 load->as_Mach()->memory_inputs(base, index);
347
348 assert(base != NodeSentinel && index != NodeSentinel,
|