private static <T extends AbstractBlockBase<T>>T addPathToLinearScanOrder(T block,List<T> order,PriorityQueue<T> worklist,BitSet visitedBlocks){
  block.setLinearScanNumber(order.size());
  order.add(block);
  T mostLikelySuccessor=findAndMarkMostLikelySuccessor(block,visitedBlocks);
  enqueueSuccessors(block,worklist,visitedBlocks);
  if (mostLikelySuccessor != null) {
    if (!mostLikelySuccessor.isLoopHeader() && mostLikelySuccessor.getPredecessorCount() > 1) {
      double unscheduledSum=0.0;
      for (      T pred : mostLikelySuccessor.getPredecessors()) {
        if (pred.getLinearScanNumber() == -1) {
          unscheduledSum+=pred.probability();
        }
      }
      if (unscheduledSum > block.probability() / PENALTY_VERSUS_UNSCHEDULED) {
        visitedBlocks.clear(mostLikelySuccessor.getId());
        return null;
      }
    }
    return mostLikelySuccessor;
  }
  return null;
}

private static < T extends AbstractBlockBase < T > > T addPathToLinearScanOrder ( T block , List < T > order , PriorityQueue < T > worklist , BitSet visitedBlocks ) { block . setLinearScanNumber ( order . size ( ) ) ; order . add ( block ) ; T mostLikelySuccessor = findAndMarkMostLikelySuccessor ( block , visitedBlocks ) ; enqueueSuccessors ( block , worklist , visitedBlocks ) ; if ( mostLikelySuccessor != null ) { if ( ! mostLikelySuccessor . isLoopHeader ( ) && mostLikelySuccessor . getPredecessorCount ( ) > 1 ) { double unscheduledSum = 0.0 ; for ( T pred : mostLikelySuccessor . getPredecessors ( ) ) { if ( pred . getLinearScanNumber ( ) == - 1 ) { unscheduledSum += pred . probability ( ) ; } } if ( unscheduledSum > block . probability ( ) / PENALTY_VERSUS_UNSCHEDULED ) { visitedBlocks . clear ( mostLikelySuccessor . getId ( ) ) ; return null ; } } return mostLikelySuccessor ; } return null ; }
add a linear path to the linear scan order greedily following the most likely successor .
