# HG changeset patch # User Thomas Wuerthinger # Date 1362663508 -3600 # Node ID 8fe43a4301dd1099ef8bcfc1b96882fa21991dcd # Parent 12b4f1521a0d7368ee8a3198a271a1b67a8f514c# Parent 9786ac8fff619c65527ff7da0902badcfad59e62 Merge. diff -r 9786ac8fff61 -r 8fe43a4301dd graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Thu Mar 07 11:58:34 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Thu Mar 07 14:38:28 2013 +0100 @@ -46,6 +46,11 @@ */ final class LinearScanWalker extends IntervalWalker { + /** + * Delta how much a probability must be lower to be considered a better split position. + */ + private static final double DELTA_FACTOR = 0.75; + private final boolean callKillsRegisters; private Register[] availableRegs; @@ -280,6 +285,7 @@ } int minLoopDepth = maxBlock.getLoopDepth(); + double probability = maxBlock.getProbability(); for (int i = toBlockNr - 1; i >= fromBlockNr; i--) { Block cur = blockAt(i); @@ -287,6 +293,9 @@ // block with lower loop-depth found . split at the end of this block minLoopDepth = cur.getLoopDepth(); optimalSplitPos = allocator.getLastLirInstructionId(cur) + 2; + } else if (cur.getLoopDepth() == minLoopDepth && cur.getProbability() < probability * DELTA_FACTOR) { + probability = cur.getProbability(); + optimalSplitPos = allocator.getLastLirInstructionId(cur) + 2; } } assert optimalSplitPos > allocator.maxOpId() || allocator.isBlockBegin(optimalSplitPos) : "algorithm must move split pos to block boundary";