changeset 5871:576460f7e740

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 20 Jul 2012 14:40:37 +0200
parents d84a26dc32f5 (diff) 44eb34b54526 (current diff)
children 7ee5463a4f48
files mx/commands.py
diffstat 7 files changed, 43 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Jul 20 12:54:02 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Jul 20 14:40:37 2012 +0200
@@ -140,6 +140,10 @@
                 new PropagateTypeCachePhase(target, runtime, assumptions).apply(graph);
             }
 
+            if (GraalOptions.OptCanonicalizer) {
+                new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
+            }
+
             if (GraalOptions.CheckCastElimination && GraalOptions.OptCanonicalizer) {
                 new IterativeCheckCastEliminationPhase(target, runtime, assumptions).apply(graph);
             }
@@ -195,6 +199,10 @@
         }
         new RemoveValueProxyPhase().apply(graph);
 
+        if (GraalOptions.OptCanonicalizer) {
+            new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
+        }
+
         if (GraalOptions.CheckCastElimination && GraalOptions.OptCanonicalizer) {
             new IterativeCheckCastEliminationPhase(target, runtime, assumptions).apply(graph);
         }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java	Fri Jul 20 12:54:02 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java	Fri Jul 20 14:40:37 2012 +0200
@@ -97,7 +97,7 @@
                 workList.addAll(graph.getNewNodes(newNodesMark));
             }
         } else {
-            workList = graph.createNodeWorkList(newNodesMark == 0, MAX_ITERATION_PER_NODE);
+            workList = graph.createNodeWorkList(false, MAX_ITERATION_PER_NODE);
             workList.addAll(initWorkingSet);
         }
         tool = new Tool(workList, runtime, target, assumptions, immutabilityPredicate);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CheckCastEliminationPhase.java	Fri Jul 20 12:54:02 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CheckCastEliminationPhase.java	Fri Jul 20 14:40:37 2012 +0200
@@ -47,12 +47,10 @@
     private static final DebugMetric metricGuardsReplaced = Debug.metric("GuardsReplaced");
 
     private StructuredGraph graph;
-    private boolean graphModified;
 
     @Override
     protected void run(StructuredGraph inputGraph) {
         graph = inputGraph;
-        graphModified = false;
         new EliminateCheckCasts(graph.start(), new State()).apply();
     }
 
@@ -307,7 +305,6 @@
                     BooleanNode condition = guard.condition();
                     ValueNode existingGuards = guard.negated() ? state.falseConditions.get(condition) : state.trueConditions.get(condition);
                     if (existingGuards != null) {
-                        graphModified = true;
                         guard.replaceAtUsages(existingGuards);
                         GraphUtil.killWithUnusedFloatingInputs(guard);
                         metricGuardsReplaced.increment();
@@ -321,7 +318,6 @@
                                 removeCheck = true;
                             }
                             if (removeCheck) {
-                                graphModified = true;
                                 metricNullCheckGuardRemoved.increment();
                             }
                         }
@@ -346,7 +342,6 @@
                     piNode = graph.unique(new PiNode(checkCast.object(), lastBegin, nonNull ? StampFactory.declaredNonNull(type) : StampFactory.declared(type)));
                     checkCast.replaceAtUsages(piNode);
                     graph.removeFixed(checkCast);
-                    graphModified = true;
                     metricCheckCastRemoved.increment();
                 }
             } else if (node instanceof IfNode) {
@@ -387,7 +382,6 @@
                     }
                 }
                 if (replaceWith != null) {
-                    graphModified = true;
                     ifNode.setCompare(replaceWith);
                     if (compare.usages().isEmpty()) {
                         GraphUtil.killWithUnusedFloatingInputs(compare);
@@ -397,8 +391,4 @@
         }
     }
 
-    public boolean wasGraphModfied() {
-        return graphModified;
-    }
-
 }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/FloatingReadPhase.java	Fri Jul 20 12:54:02 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/FloatingReadPhase.java	Fri Jul 20 14:40:37 2012 +0200
@@ -91,19 +91,19 @@
                 }
             }
 
-            IdentityHashMap<Object, Object> keys = new IdentityHashMap<>();
+            Set<Object> keys = new HashSet<>();
             for (Object key : lastMemorySnapshot.keySet()) {
-                keys.put(key, key);
+                keys.add(key);
             }
             for (MemoryMap other : withStates) {
                 assert other.loops.size() == loops.size();
                 assert other.loops.size() < 1 || other.loops.peek().loopBegin == loops.peek().loopBegin;
                 for (Object key : other.lastMemorySnapshot.keySet()) {
-                    keys.put(key, key);
+                    keys.add(key);
                 }
             }
 
-            for (Object key : keys.keySet()) {
+            for (Object key : keys) {
                 ValueNode merged = lastMemorySnapshot.get(key);
                 if (merged == null) {
                     merged = lastMemorySnapshot.get(LocationNode.ANY_LOCATION);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/IterativeCheckCastEliminationPhase.java	Fri Jul 20 12:54:02 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/IterativeCheckCastEliminationPhase.java	Fri Jul 20 14:40:37 2012 +0200
@@ -22,7 +22,11 @@
  */
 package com.oracle.graal.compiler.phases;
 
+import java.util.*;
+
 import com.oracle.graal.api.code.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.graph.Graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 
@@ -34,27 +38,35 @@
 
     public IterativeCheckCastEliminationPhase(TargetDescription target, GraalCodeCacheProvider runtime, Assumptions assumptions) {
         this.target = target;
-        // TODO Auto-generated constructor stub
         this.runtime = runtime;
         this.assumptions = assumptions;
     }
 
     @Override
     protected void run(StructuredGraph graph) {
+        Set<Node> canonicalizationRoots = new HashSet<>();
         CheckCastEliminationPhase eliminate = new CheckCastEliminationPhase();
-        CanonicalizerPhase canon = new CanonicalizerPhase(target, runtime, assumptions);
-        boolean canonRun = false;
+        Listener listener = new Listener(canonicalizationRoots);
         while (true) {
+            graph.trackInputChange(listener);
             eliminate.apply(graph);
-            if (!eliminate.wasGraphModfied()) {
+            graph.stopTrackingInputChange();
+            if (canonicalizationRoots.isEmpty()) {
                 break;
             }
-            canon.apply(graph);
-            canonRun = true;
-        }
-        if (!canonRun) {
-            canon.apply(graph);
+            new CanonicalizerPhase(target, runtime, assumptions, canonicalizationRoots, null).apply(graph);
+            canonicalizationRoots.clear();
         }
     }
 
+    private static class Listener implements InputChangedListener {
+        private final Set<Node> canonicalizationRoots;
+        public Listener(Set<Node> canonicalizationRoots) {
+            this.canonicalizationRoots = canonicalizationRoots;
+        }
+        @Override
+        public void inputChanged(Node node) {
+            canonicalizationRoots.add(node);
+        }
+    }
 }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java	Fri Jul 20 12:54:02 2012 +0200
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java	Fri Jul 20 14:40:37 2012 +0200
@@ -59,7 +59,9 @@
 
     public void addAll(Iterable<? extends Node> nodes) {
         for (Node node : nodes) {
-            this.add(node);
+            if (node.isAlive()) {
+                this.add(node);
+            }
         }
     }
 
--- a/mx/commands.py	Fri Jul 20 12:54:02 2012 +0200
+++ b/mx/commands.py	Fri Jul 20 14:40:37 2012 +0200
@@ -296,7 +296,9 @@
     Get the JDK into which Graal is installed, creating it first if necessary.
     """
     jdk = join(_graal_home, 'jdk' + mx.java().version, build)
-    jdkContents = ['bin', 'db', 'include', 'jre', 'lib']
+    jdkContents = ['bin', 'include', 'jre', 'lib']
+    if (exists(join(jdk, 'db'))):
+        jdkContents.append('db')
     if mx.get_os() != 'windows':
         jdkContents.append('man')
     if create:
@@ -379,11 +381,11 @@
                 ret = True
         if line == ENDTOKEN:
             if not findInOutput:
-                stdin.write('echo ERR%errorlevel%' + newLine)
+                stdin.write('echo ERRXXX%errorlevel%' + newLine)
             else:
                 break
-        if line.startswith('ERR'):
-            if line == 'ERR0':
+        if line.startswith('ERRXXX'):
+            if line == 'ERRXXX0':
                 ret = True
             break;
     stdin.write('exit' + newLine)