Mercurial > hg > truffle
changeset 5220:a9e4b30968d4
Estimate size of loop and peel only if resulting graph is not too big
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 10 Apr 2012 14:05:14 +0200 |
parents | b64933dc4830 |
children | d066f83db303 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoopTransformPhase.java |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java Mon Apr 09 20:43:30 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java Tue Apr 10 14:05:14 2012 +0200 @@ -56,4 +56,12 @@ } return new SuperBlock(loop.loopBegin(), loop.loopBegin(), blocks, earlyExits, loop.loopBegin()); } + + public static int estimateSize(Loop loop) { + int fixed = 0; + for (Block b : loop.blocks) { + fixed += b.getBeginNode().getBlockNodes().count(); + } + return fixed * 3; + } }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoopTransformPhase.java Mon Apr 09 20:43:30 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoopTransformPhase.java Tue Apr 10 14:05:14 2012 +0200 @@ -46,7 +46,8 @@ }); for (Loop loop : loops) { double entryProbability = loop.loopBegin().forwardEnd().probability(); - if (entryProbability > GraalOptions.MinimumPeelProbability) { + if (entryProbability > GraalOptions.MinimumPeelProbability + && LoopTransformUtil.estimateSize(loop) + graph.getNodeCount() < GraalOptions.MaximumDesiredSize) { Debug.log("Peeling %s", loop); LoopTransformUtil.peel(loop); Debug.dump(graph, "After peeling %s", loop);