changeset 10029:839791e70ff1

Method for adding a new phase at the beginning of a suite.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 13 Jun 2013 13:19:56 +0200
parents 3a7a8666df94
children 85f926430ae6
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhaseSuite.java
diffstat 6 files changed, 46 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- 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));
     }
 }
--- 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<LowTierContext> {
 
     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());
     }
 }
--- 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<MidTierContext> 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);
         }
     }
 }
--- 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;
--- 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<PhaseContext> canonicalizer = new IncrementalCanonicalizerPhase<>();
-            canonicalizer.addPhase(round);
+            canonicalizer.appendPhase(round);
             canonicalizer.apply(graph, context);
 
             if (!round.deferred && !containsLowerable(graph.getNewNodes(mark))) {
--- 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<? super C> phase) {
+    /**
+     * Add a new phase at the beginning of this suite.
+     */
+    public final void prependPhase(BasePhase<? super C> phase) {
+        phases.add(0, phase);
+    }
+
+    /**
+     * Add a new phase at the end of this suite.
+     */
+    public final void appendPhase(BasePhase<? super C> phase) {
         phases.add(phase);
     }