# HG changeset patch # User Thomas Wuerthinger # Date 1357764097 -3600 # Node ID 40be0ff5a3ce70be0c0367b9c48194921895d933 # Parent a64cf879716613d26d7bf306004dac61ec9f04bd Include probability when calculating block weight. diff -r a64cf8797166 -r 40be0ff5a3ce graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java Wed Jan 09 21:19:10 2013 +0100 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java Wed Jan 09 21:41:37 2013 +0100 @@ -163,6 +163,16 @@ } curBit--; + if (cur.getBeginNode().probability() > 0.5) { + weight |= 1 << curBit; + } + curBit--; + + if (cur.getBeginNode().probability() > 0.05) { + weight |= 1 << curBit; + } + curBit--; + // guarantee that weight is > 0 weight |= 1; @@ -265,18 +275,22 @@ do { Block cur = workList.remove(workList.size() - 1); - appendBlock(cur); - - Node endNode = cur.getEndNode(); - if (endNode instanceof IfNode && ((IfNode) endNode).probability() < 0.5) { - assert cur.numberOfSux() == 2; - checkAndSortIntoWorkList(cur.suxAt(1)); - checkAndSortIntoWorkList(cur.suxAt(0)); - } else { - for (Block sux : cur.getSuccessors()) { - checkAndSortIntoWorkList(sux); - } - } + processBlock(cur); } while (workList.size() > 0); } + + private void processBlock(Block cur) { + appendBlock(cur); + + Node endNode = cur.getEndNode(); + if (endNode instanceof IfNode && ((IfNode) endNode).probability() < 0.5) { + assert cur.numberOfSux() == 2; + checkAndSortIntoWorkList(cur.suxAt(1)); + checkAndSortIntoWorkList(cur.suxAt(0)); + } else { + for (Block sux : cur.getSuccessors()) { + checkAndSortIntoWorkList(sux); + } + } + } }