Mercurial > hg > truffle
changeset 13300:d5e65a244f7d
rename BooleanSwitch to BinarySwitch
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 12 Dec 2013 09:47:11 +0100 |
parents | d64c0112fb94 |
children | 126ef8e8aa59 d8692e751c65 |
files | graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java Wed Dec 11 21:57:10 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java Thu Dec 12 09:47:11 2013 +0100 @@ -314,13 +314,13 @@ } } - public static class BooleanStrategy extends SwitchStrategy { + public static class BinaryStrategy extends SwitchStrategy { private static final double MIN_PROBABILITY = 0.00001; private final double[] probabilitySums; - public BooleanStrategy(double[] keyProbabilities, Constant[] keyConstants) { + public BinaryStrategy(double[] keyProbabilities, Constant[] keyConstants) { super(keyProbabilities, keyConstants); probabilitySums = new double[keyProbabilities.length + 1]; double sum = 0; @@ -332,15 +332,15 @@ @Override public void run(SwitchClosure closure) { - recurseBooleanSwitch(closure, 0, keyConstants.length - 1, 0); + recurseBinarySwitch(closure, 0, keyConstants.length - 1, 0); } /** * Recursively generate a list of comparisons that always subdivides the key list in the * middle (in terms of probability, not index). */ - private void recurseBooleanSwitch(SwitchClosure closure, int left, int right, int startDepth) { - assert startDepth < keyConstants.length * 3 : "runaway recursion in boolean switch"; + private void recurseBinarySwitch(SwitchClosure closure, int left, int right, int startDepth) { + assert startDepth < keyConstants.length * 3 : "runaway recursion in binary switch"; int depth = startDepth; boolean leftBorder = left == 0; boolean rightBorder = right == keyConstants.length - 1; @@ -398,7 +398,7 @@ registerEffort(middle + 1, right, depth); } } else { - recurseBooleanSwitch(closure, middle + 1, right, depth); + recurseBinarySwitch(closure, middle + 1, right, depth); } } } else if (getSliceEnd(closure, middle + 1) == right) { @@ -408,13 +408,13 @@ } closure.conditionalJump(middle + 1, Condition.GE, false); registerEffort(middle + 1, right, ++depth); - recurseBooleanSwitch(closure, left, middle, depth); + recurseBinarySwitch(closure, left, middle, depth); } else { Label label = closure.conditionalJump(middle + 1, Condition.GE); depth++; - recurseBooleanSwitch(closure, left, middle, depth); + recurseBinarySwitch(closure, left, middle, depth); closure.bind(label); - recurseBooleanSwitch(closure, middle + 1, right, depth); + recurseBinarySwitch(closure, middle + 1, right, depth); } } } @@ -423,7 +423,7 @@ private static SwitchStrategy[] getStrategies(double[] keyProbabilities, Constant[] keyConstants, LabelRef[] keyTargets) { SwitchStrategy[] strategies = new SwitchStrategy[]{new SequentialStrategy(keyProbabilities, keyConstants), new RangesStrategy(keyProbabilities, keyConstants), - new BooleanStrategy(keyProbabilities, keyConstants)}; + new BinaryStrategy(keyProbabilities, keyConstants)}; for (SwitchStrategy strategy : strategies) { strategy.effortClosure = strategy.new EffortClosure(keyTargets); strategy.run(strategy.effortClosure);