changeset 5411:128b3f574991

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 15 May 2012 16:27:12 +0200
parents c574c4540791 (current diff) 206df7b3e022 (diff)
children bb47fd6a6290
files
diffstat 4 files changed, 33 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java	Tue May 15 14:29:14 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformUtil.java	Tue May 15 16:27:12 2012 +0200
@@ -55,7 +55,7 @@
         for (Block b : loop.exits) {
             earlyExits.add(b.getBeginNode());
         }
-        return new SuperBlock(loop.loopBegin(), loop.loopBegin(), blocks, earlyExits, loop.loopBegin());
+        return new SuperBlock(loop.loopBegin(), loop.loopBegin(), blocks, earlyExits);
     }
 
     public static int estimateSize(Loop loop) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/SuperBlock.java	Tue May 15 14:29:14 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/SuperBlock.java	Tue May 15 16:27:12 2012 +0200
@@ -36,17 +36,15 @@
     protected BeginNode exit;
     protected List<BeginNode> blocks;
     protected List<BeginNode> earlyExits;
-    protected LoopBeginNode loop;
     protected Map<Node, Node> duplicationMapping;
     protected SuperBlock original;
     protected NodeBitMap loopNodes;
 
-    public SuperBlock(BeginNode entry, BeginNode exit, List<BeginNode> blocks, List<BeginNode> earlyExits, LoopBeginNode loop) {
+    public SuperBlock(BeginNode entry, BeginNode exit, List<BeginNode> blocks, List<BeginNode> earlyExits) {
         this.entry = entry;
         this.exit = exit;
         this.blocks = blocks;
         this.earlyExits = earlyExits;
-        this.loop = loop;
         assert blocks.contains(entry);
         assert !blocks.contains(exit) || exit == entry;
     }
@@ -83,8 +81,8 @@
             newEarlyExits.add(newEarlyExit);
             replacements.put(earlyExit, newEarlyExit);
         }
-        if (loop != null) {
-            for (LoopEndNode end : loop.loopEnds()) {
+        if (exit instanceof LoopBeginNode) {
+            for (LoopEndNode end : ((LoopBeginNode) exit).loopEnds()) {
                 if (nodes.isMarked(end)) {
                     replacements.put(end, graph.add(new EndNode()));
                 }
@@ -92,7 +90,7 @@
         }
         Map<Node, Node> duplicates = graph.addDuplicates(nodes, replacements);
         if (exit instanceof MergeNode) {
-            newExit = mergeExits(replacements, graph, duplicates, (MergeNode) exit);
+            newExit = mergeExits(replacements, duplicates);
         }
 
         List<BeginNode> newBlocks = new ArrayList<>(blocks.size());
@@ -107,16 +105,20 @@
         for (Entry<Node, Node> e : replacements.entrySet()) {
             duplicates.put(e.getKey(), e.getValue());
         }
-        SuperBlock superBlock = new SuperBlock(newEntry, newExit, newBlocks, newEarlyExits, loop);
+        SuperBlock superBlock = new SuperBlock(newEntry, newExit, newBlocks, newEarlyExits);
         superBlock.duplicationMapping = duplicates;
         superBlock.original = this;
         return superBlock;
     }
 
-    private BeginNode mergeExits(Map<Node, Node> replacements, StructuredGraph graph, Map<Node, Node> duplicates, MergeNode mergeExit) {
-        BeginNode newExit;
+    protected StructuredGraph graph() {
+        return (StructuredGraph) entry.graph();
+    }
+
+    private BeginNode mergeExits(Map<Node, Node> replacements, Map<Node, Node> duplicates) {
         List<EndNode> endsToMerge = new LinkedList<>();
-        if (mergeExit == loop) {
+        MergeNode mergeExit = (MergeNode) exit;
+        if (mergeExit instanceof LoopBeginNode) {
             LoopBeginNode loopBegin = (LoopBeginNode) mergeExit;
             for (LoopEndNode le : loopBegin.loopEnds()) {
                 Node duplicate = replacements.get(le);
@@ -132,7 +134,12 @@
                 }
             }
         }
+        return mergeEnds(mergeExit, endsToMerge);
+    }
 
+    private BeginNode mergeEnds(MergeNode mergeExit, List<EndNode> endsToMerge) {
+        BeginNode newExit;
+        StructuredGraph graph = graph();
         if (endsToMerge.size() == 1) {
             EndNode end = endsToMerge.get(0);
             assert end.usages().count() == 0;
@@ -143,8 +150,12 @@
             assert endsToMerge.size() > 1;
             MergeNode newExitMerge = graph.add(new MergeNode());
             newExit = newExitMerge;
-            FrameState state = mergeExit.stateAfter().duplicate();
-            newExitMerge.setStateAfter(state); // this state is wrong (incudes phis from the loop begin) needs to be fixed while resolving data
+            FrameState state = mergeExit.stateAfter();
+            if (state != null) {
+                FrameState duplicateState = state.duplicate();
+                // this state is wrong (incudes phis from the loop begin) needs to be fixed while resolving data
+                newExitMerge.setStateAfter(duplicateState);
+            }
             for (EndNode end : endsToMerge) {
                 newExitMerge.addForwardEnd(end);
             }
@@ -360,7 +371,7 @@
         for (BeginNode b : blocks) {
             for (Node n : b.getBlockNodes()) {
                 for (Node usage : n.usages()) {
-                    markFloating(usage, nodes, "");
+                    markFloating(usage, nodes);
                 }
             }
         }
@@ -374,8 +385,7 @@
         return nodes;
     }
 
-    private static boolean markFloating(Node n, NodeBitMap loopNodes, String ind) {
-        //System.out.println(ind + "markFloating(" + n + ")");
+    private static boolean markFloating(Node n, NodeBitMap loopNodes) {
         if (loopNodes.isMarked(n)) {
             return true;
         }
@@ -384,7 +394,8 @@
         }
         boolean mark = false;
         if (n instanceof PhiNode) {
-            mark = loopNodes.isMarked(((PhiNode) n).merge());
+            PhiNode phi = (PhiNode) n;
+            mark = loopNodes.isMarked(phi.merge());
             if (mark) {
                 loopNodes.mark(n);
             } else {
@@ -392,7 +403,7 @@
             }
         }
         for (Node usage : n.usages()) {
-            if (markFloating(usage, loopNodes, " " + ind)) {
+            if (markFloating(usage, loopNodes)) {
                 mark = true;
             }
         }
--- a/mx/commands.py	Tue May 15 14:29:14 2012 +0200
+++ b/mx/commands.py	Tue May 15 16:27:12 2012 +0200
@@ -676,7 +676,7 @@
         if len(neg) != 0:
             classes = [c for c in classes if not containsAny(c, neg)]
             
-        vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes)
+        vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=com/oracle/graal/jtt', '-XX:CompileCommand=exclude,com/oracle/graal/jtt*.run*', '-XX:CompileCommand=quiet', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes)
     
 def buildvms(args):
     """build one or more VMs in various configurations"""
--- a/src/share/vm/opto/bytecodeInfo.cpp	Tue May 15 14:29:14 2012 +0200
+++ b/src/share/vm/opto/bytecodeInfo.cpp	Tue May 15 16:27:12 2012 +0200
@@ -240,6 +240,9 @@
     // ignore heuristic controls on inlining
     return NULL;
   }
+  if (callee_method->should_not_inline()) {
+    return "disallowed by CompilerOracle";
+  }
 
   // Now perform checks which are heuristic
 
@@ -278,10 +281,6 @@
     }
   }
 
-  if (callee_method->should_not_inline()) {
-    return "disallowed by CompilerOracle";
-  }
-
   if (UseStringCache) {
     // Do not inline StringCache::profile() method used only at the beginning.
     if (callee_method->name() == ciSymbol::profile_name() &&