# HG changeset patch # User Lukas Stadler # Date 1367605527 -7200 # Node ID c45c0bda360298f492bd96d020332080fb79abcc # Parent 52353ed06cdfe8e89d4c59fa81a980676fffc6fa# Parent 05b8a812b4879a3c9ff1d91fad607081fdcecac4 Merge (fixed: 05b8a812b487 Remove dead IsNull nodes in Guard lowering phase) diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierVerificationTest.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierVerificationTest.java Fri May 03 20:25:27 2013 +0200 @@ -33,6 +33,7 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.Lowerable.*; +import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.graph.*; import com.oracle.graal.phases.graph.ReentrantNodeIterator.*; @@ -618,7 +619,7 @@ public void run() { final StructuredGraph graph = parse(snippet); HighTierContext highTierContext = new HighTierContext(runtime(), new Assumptions(false), replacements); - MidTierContext midTierContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget()); + MidTierContext midTierContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, highTierContext); new GuardLoweringPhase().apply(graph, midTierContext); diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri May 03 20:25:27 2013 +0200 @@ -141,12 +141,12 @@ Suites.DEFAULT.getHighTier().apply(graph, highTierContext); - MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target); + MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts); Suites.DEFAULT.getMidTier().apply(graph, midTierContext); plan.runPhases(PhasePosition.LOW_LEVEL, graph); - LowTierContext lowTierContext = new LowTierContext(runtime, assumptions, replacements, target, optimisticOpts); + LowTierContext lowTierContext = new LowTierContext(runtime, assumptions, replacements, target); Suites.DEFAULT.getLowTier().apply(graph, lowTierContext); final SchedulePhase schedule = new SchedulePhase(); diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java Fri May 03 20:25:27 2013 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.compiler.phases; +import com.oracle.graal.loop.phases.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -66,7 +67,8 @@ addPhase(new CanonicalizerPhase()); } - // Add safepoints to loops + addPhase(new LoopSafepointEliminationPhase()); + addPhase(new SafepointInsertionPhase()); addPhase(new GuardLoweringPhase()); diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopSafepointEliminationPhase.java Fri May 03 20:25:27 2013 +0200 @@ -30,10 +30,10 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; -public class LoopSafepointEliminationPhase extends BasePhase { +public class LoopSafepointEliminationPhase extends BasePhase { @Override - protected void run(StructuredGraph graph, LowTierContext context) { + protected void run(StructuredGraph graph, MidTierContext context) { LoopsData loops = new LoopsData(graph); if (context.getOptimisticOptimizations().useLoopLimitChecks()) { loops.detectedCountedLoops(); diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Fri May 03 20:25:27 2013 +0200 @@ -193,6 +193,9 @@ IsNullNode isNull = (IsNullNode) guard.condition(); NullCheckNode nullCheck = guard.graph().add(new NullCheckNode(isNull.object())); replaceCurrent(nullCheck); + if (isNull.usages().isEmpty()) { + isNull.safeDelete(); + } } private void insertLoopExits(DeoptimizeNode deopt) { diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java Fri May 03 20:25:27 2013 +0200 @@ -25,24 +25,17 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.phases.*; public class LowTierContext extends PhaseContext { private final TargetDescription target; - private final OptimisticOptimizations optimisticOpts; - public LowTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, TargetDescription target, OptimisticOptimizations optimisticOpts) { + public LowTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, TargetDescription target) { super(runtime, assumptions, replacements); this.target = target; - this.optimisticOpts = optimisticOpts; } public TargetDescription getTarget() { return target; } - - public OptimisticOptimizations getOptimisticOptimizations() { - return optimisticOpts; - } } diff -r 52353ed06cdf -r c45c0bda3602 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Fri May 03 20:24:49 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Fri May 03 20:25:27 2013 +0200 @@ -25,17 +25,24 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.phases.*; public class MidTierContext extends PhaseContext { private final TargetDescription target; + private final OptimisticOptimizations optimisticOpts; - public MidTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, TargetDescription target) { + public MidTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, TargetDescription target, OptimisticOptimizations optimisticOpts) { super(runtime, assumptions, replacements); this.target = target; + this.optimisticOpts = optimisticOpts; } public TargetDescription getTarget() { return target; } + + public OptimisticOptimizations getOptimisticOptimizations() { + return optimisticOpts; + } }