Mercurial > hg > graal-compiler
changeset 22873:3566ad79cf86
Check guards stage before optimizing or inserting guards
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 20 Oct 2015 15:56:18 +0200 |
parents | ad106dd2000c |
children | b308931fc253 |
files | graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java |
diffstat | 3 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Tue Oct 20 15:55:40 2015 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Tue Oct 20 15:56:18 2015 +0200 @@ -175,6 +175,7 @@ } cond = graph.unique(new IntegerLessThanNode(end, v1)); } + assert graph.getGuardsStage().allowsFloatingGuards(); overflowGuard = graph.unique(new GuardNode(cond, AbstractBeginNode.prevBegin(loop.entryPoint()), DeoptimizationReason.LoopLimitCheck, DeoptimizationAction.InvalidateRecompile, true, JavaConstant.NULL_POINTER)); // TODO gd: use speculation loop.loopBegin().setOverflowGuard(overflowGuard);
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java Tue Oct 20 15:55:40 2015 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java Tue Oct 20 15:56:18 2015 +0200 @@ -38,7 +38,7 @@ @Override protected void run(StructuredGraph graph, MidTierContext context) { LoopsData loops = new LoopsData(graph); - if (context.getOptimisticOptimizations().useLoopLimitChecks()) { + if (context.getOptimisticOptimizations().useLoopLimitChecks() && graph.getGuardsStage().allowsFloatingGuards()) { loops.detectedCountedLoops(); for (LoopEx loop : loops.countedLoops()) { if (loop.loop().getChildren().isEmpty() && loop.counted().getStamp().getBits() <= 32) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java Tue Oct 20 15:55:40 2015 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java Tue Oct 20 15:56:18 2015 +0200 @@ -63,6 +63,9 @@ @Override protected void run(StructuredGraph graph) { + if (!graph.getGuardsStage().allowsFloatingGuards()) { + return; + } LazyCFG cfg = new LazyCFG(graph); for (AbstractBeginNode begin : graph.getNodes(AbstractBeginNode.TYPE)) { if (!(begin instanceof StartNode || begin.predecessor() instanceof ControlSplitNode)) {