# HG changeset patch # User Roland Schatz # Date 1371122396 -7200 # Node ID 839791e70ff1e345e9e135540b83692bc0c386f9 # Parent 3a7a8666df9431588ebf3b7b2002388f8f894680 Method for adding a new phase at the beginning of a suite. diff -r 3a7a8666df94 -r 839791e70ff1 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Wed Jun 12 17:09:18 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Thu Jun 13 13:19:56 2013 +0200 @@ -37,37 +37,37 @@ CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); if (FullUnroll.getValue()) { - addPhase(new LoopFullUnrollPhase(!AOTCompilation.getValue())); + appendPhase(new LoopFullUnrollPhase(!AOTCompilation.getValue())); } if (OptTailDuplication.getValue()) { - addPhase(new TailDuplicationPhase()); + appendPhase(new TailDuplicationPhase()); } if (PartialEscapeAnalysis.getValue()) { - addPhase(new PartialEscapePhase(true, canonicalizer)); + appendPhase(new PartialEscapePhase(true, canonicalizer)); } if (OptConvertDeoptsToGuards.getValue()) { - addPhase(new ConvertDeoptimizeToGuardPhase()); + appendPhase(new ConvertDeoptimizeToGuardPhase()); } - addPhase(new LockEliminationPhase()); + appendPhase(new LockEliminationPhase()); if (OptLoopTransform.getValue()) { - addPhase(new LoopTransformHighPhase()); - addPhase(new LoopTransformLowPhase()); + appendPhase(new LoopTransformHighPhase()); + appendPhase(new LoopTransformLowPhase()); } - addPhase(new RemoveValueProxyPhase()); + appendPhase(new RemoveValueProxyPhase()); if (CullFrameStates.getValue()) { - addPhase(new CullFrameStatesPhase()); + appendPhase(new CullFrameStatesPhase()); } if (OptCanonicalizer.getValue()) { - addPhase(canonicalizer); + appendPhase(canonicalizer); } - addPhase(new LoweringPhase(LoweringType.BEFORE_GUARDS)); + appendPhase(new LoweringPhase(LoweringType.BEFORE_GUARDS)); } } diff -r 3a7a8666df94 -r 839791e70ff1 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java Wed Jun 12 17:09:18 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java Thu Jun 13 13:19:56 2013 +0200 @@ -30,12 +30,12 @@ public class LowTier extends PhaseSuite { public LowTier() { - addPhase(new LoweringPhase(LoweringType.AFTER_GUARDS)); + appendPhase(new LoweringPhase(LoweringType.AFTER_GUARDS)); - addPhase(new FrameStateAssignmentPhase()); + appendPhase(new FrameStateAssignmentPhase()); - addPhase(new ExpandLogicPhase()); + appendPhase(new ExpandLogicPhase()); - addPhase(new DeadCodeEliminationPhase()); + appendPhase(new DeadCodeEliminationPhase()); } } diff -r 3a7a8666df94 -r 839791e70ff1 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 Wed Jun 12 17:09:18 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java Thu Jun 13 13:19:56 2013 +0200 @@ -35,50 +35,50 @@ CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); if (OptPushThroughPi.getValue()) { - addPhase(new PushThroughPiPhase()); + appendPhase(new PushThroughPiPhase()); if (OptCanonicalizer.getValue()) { - addPhase(canonicalizer); + appendPhase(canonicalizer); } } if (OptFloatingReads.getValue()) { IncrementalCanonicalizerPhase incCanonicalizer = new IncrementalCanonicalizerPhase<>(); - incCanonicalizer.addPhase(new FloatingReadPhase()); - addPhase(incCanonicalizer); + incCanonicalizer.appendPhase(new FloatingReadPhase()); + appendPhase(incCanonicalizer); if (OptReadElimination.getValue()) { - addPhase(new ReadEliminationPhase()); + appendPhase(new ReadEliminationPhase()); } } - addPhase(new RemoveValueProxyPhase()); + appendPhase(new RemoveValueProxyPhase()); if (OptCanonicalizer.getValue()) { - addPhase(canonicalizer); + appendPhase(canonicalizer); } if (OptEliminatePartiallyRedundantGuards.getValue()) { - addPhase(new EliminatePartiallyRedundantGuardsPhase(false, true)); + appendPhase(new EliminatePartiallyRedundantGuardsPhase(false, true)); } if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { - addPhase(new IterativeConditionalEliminationPhase()); + appendPhase(new IterativeConditionalEliminationPhase()); } if (OptEliminatePartiallyRedundantGuards.getValue()) { - addPhase(new EliminatePartiallyRedundantGuardsPhase(true, true)); + appendPhase(new EliminatePartiallyRedundantGuardsPhase(true, true)); } if (OptCanonicalizer.getValue()) { - addPhase(canonicalizer); + appendPhase(canonicalizer); } - addPhase(new LoopSafepointEliminationPhase()); + appendPhase(new LoopSafepointEliminationPhase()); - addPhase(new SafepointInsertionPhase()); + appendPhase(new SafepointInsertionPhase()); - addPhase(new GuardLoweringPhase()); + appendPhase(new GuardLoweringPhase()); if (OptCanonicalizer.getValue()) { - addPhase(canonicalizer); + appendPhase(canonicalizer); } } } diff -r 3a7a8666df94 -r 839791e70ff1 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed Jun 12 17:09:18 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Jun 13 13:19:56 2013 +0200 @@ -1074,15 +1074,15 @@ if (AOTCompilation.getValue()) { // lowering introduces class constants, therefore it must be after lowering - ret.getHighTier().addPhase(new LoadJavaMirrorWithKlassPhase()); + ret.getHighTier().appendPhase(new LoadJavaMirrorWithKlassPhase()); if (VerifyPhases.getValue()) { - ret.getHighTier().addPhase(new AheadOfTimeVerifcationPhase()); + ret.getHighTier().appendPhase(new AheadOfTimeVerifcationPhase()); } } - ret.getMidTier().addPhase(new WriteBarrierAdditionPhase()); + ret.getMidTier().appendPhase(new WriteBarrierAdditionPhase()); if (VerifyPhases.getValue()) { - ret.getMidTier().addPhase(new WriteBarrierVerificationPhase()); + ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase()); } return ret; diff -r 3a7a8666df94 -r 839791e70ff1 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Wed Jun 12 17:09:18 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Thu Jun 13 13:19:56 2013 +0200 @@ -156,7 +156,7 @@ int mark = graph.getMark(); IncrementalCanonicalizerPhase canonicalizer = new IncrementalCanonicalizerPhase<>(); - canonicalizer.addPhase(round); + canonicalizer.appendPhase(round); canonicalizer.apply(graph, context); if (!round.deferred && !containsLowerable(graph.getNewNodes(mark))) { diff -r 3a7a8666df94 -r 839791e70ff1 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java Wed Jun 12 17:09:18 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java Thu Jun 13 13:19:56 2013 +0200 @@ -34,7 +34,17 @@ this.phases = new ArrayList<>(); } - public final void addPhase(BasePhase phase) { + /** + * Add a new phase at the beginning of this suite. + */ + public final void prependPhase(BasePhase phase) { + phases.add(0, phase); + } + + /** + * Add a new phase at the end of this suite. + */ + public final void appendPhase(BasePhase phase) { phases.add(phase); }