changeset 3203:ccae0eb6c652

Merge
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Fri, 08 Jul 2011 18:35:51 +0200
parents 9352a9c26095 (current diff) 240d921078f3 (diff)
children 8f51f5850652
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmetic.java graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAdd.java
diffstat 23 files changed, 178 insertions(+), 167 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Fri Jul 08 18:35:51 2011 +0200
@@ -45,6 +45,7 @@
 import com.oracle.max.graal.compiler.value.*;
 import com.oracle.max.graal.compiler.value.FrameState.ValueProcedure;
 import com.oracle.max.graal.graph.*;
+import com.sun.cri.bytecode.*;
 import com.sun.cri.bytecode.Bytecodes.MemoryBarriers;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -1240,6 +1241,10 @@
         }
     }
 
+    public void integerAdd(Value result, Value left, Value right) {
+        arithmeticOpInt(Bytecodes.IADD, createResultVariable(result), load(left), load(right), CiValue.IllegalValue);
+    }
+
     public void arithmeticOpInt(int code, CiValue result, CiValue left, CiValue right, CiValue tmp) {
         CiValue leftOp = left;
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java	Fri Jul 08 18:35:51 2011 +0200
@@ -28,7 +28,7 @@
 import com.sun.cri.ci.*;
 
 
-public final class IntegerAdd extends IntegerArithmetic {
+public final class IntegerAdd extends IntegerArithmeticNode {
     private static final IntegerAddCanonicalizerOp CANONICALIZER = new IntegerAddCanonicalizerOp();
 
     public IntegerAdd(CiKind kind, Value x, Value y, Graph graph) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmetic.java	Fri Jul 08 18:00:39 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.graal.compiler.ir;
-
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.ci.*;
-
-
-public abstract class IntegerArithmetic extends Arithmetic {
-
-    public IntegerArithmetic(CiKind kind, int opcode, Value x, Value y, Graph graph) {
-        super(kind, opcode, x, y, false, graph);
-        assert kind == CiKind.Int || kind == CiKind.Long;
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmeticNode.java	Fri Jul 08 18:35:51 2011 +0200
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.max.graal.compiler.ir;
+
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.ci.*;
+
+
+public abstract class IntegerArithmeticNode extends Arithmetic {
+
+    public IntegerArithmeticNode(CiKind kind, int opcode, Value x, Value y, Graph graph) {
+        super(kind, opcode, x, y, false, graph);
+        assert kind == CiKind.Int || kind == CiKind.Long;
+    }
+
+}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java	Fri Jul 08 18:35:51 2011 +0200
@@ -28,7 +28,7 @@
 import com.sun.cri.ci.*;
 
 
-public final class IntegerDiv extends IntegerArithmetic {
+public final class IntegerDiv extends IntegerArithmeticNode {
     private static final IntegerDivCanonicalizerOp CANONICALIZER = new IntegerDivCanonicalizerOp();
 
     public IntegerDiv(CiKind kind, Value x, Value y, Graph graph) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java	Fri Jul 08 18:35:51 2011 +0200
@@ -28,7 +28,7 @@
 import com.sun.cri.ci.*;
 
 
-public final class IntegerMul extends IntegerArithmetic {
+public final class IntegerMul extends IntegerArithmeticNode {
     private static final IntegerMulCanonicalizerOp CANONICALIZER = new IntegerMulCanonicalizerOp();
 
     public IntegerMul(CiKind kind, Value x, Value y, Graph graph) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java	Fri Jul 08 18:35:51 2011 +0200
@@ -28,7 +28,7 @@
 import com.sun.cri.ci.*;
 
 
-public final class IntegerRem extends IntegerArithmetic {
+public final class IntegerRem extends IntegerArithmeticNode {
     private static final IntegerRemCanonicalizerOp CANONICALIZER = new IntegerRemCanonicalizerOp();
 
     public IntegerRem(CiKind kind, Value x, Value y, Graph graph) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java	Fri Jul 08 18:35:51 2011 +0200
@@ -28,7 +28,7 @@
 import com.sun.cri.ci.*;
 
 
-public final class IntegerSub extends IntegerArithmetic {
+public final class IntegerSub extends IntegerArithmeticNode {
     private static final IntegerSubCanonicalizerOp CANONICALIZER = new IntegerSubCanonicalizerOp();
 
     public IntegerSub(CiKind kind, Value x, Value y, Graph graph) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Fri Jul 08 18:35:51 2011 +0200
@@ -352,9 +352,9 @@
         for (InliningGuide guide : serviceLoader) {
             InliningHint hint = guide.getHint(iteration, caller, bci, target);
 
-            if (hint == InliningHint.ALWAYS_INLINE) {
+            if (hint == InliningHint.ALWAYS) {
                 alwaysInline = true;
-            } else if (hint == InliningHint.NEVER_INLINE) {
+            } else if (hint == InliningHint.NEVER) {
                 neverInline = true;
             }
         }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/extensions/InliningExample.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/extensions/InliningExample.java	Fri Jul 08 18:35:51 2011 +0200
@@ -32,10 +32,6 @@
         System.out.println(System.currentTimeMillis() - start);
     }
 
-    private static int test() {
-        return alwaysInline(30);
-    }
-
     public static int testFib() {
         int sum = 0;
         for (int i = 0; i < 10000000; ++i) {
@@ -44,18 +40,19 @@
         return sum;
     }
 
+    private static int test() {
+        return alwaysInline(30);
+    }
+
     public static int alwaysInline(int value) {
-        if (value == 0) {
+        if (value < 0) {
             return neverInline(value);
         }
         return alwaysInline(value - 1);
     }
 
     public static int neverInline(int value) {
-        if (value == 0) {
-            return 0;
-        }
-        return neverInline(value - 1);
+        return value;
     }
 
     public static int fib(int val) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/extensions/InliningHint.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/extensions/InliningHint.java	Fri Jul 08 18:35:51 2011 +0200
@@ -25,6 +25,8 @@
 
 public enum InliningHint {
     NONE,
-    ALWAYS_INLINE,
-    NEVER_INLINE
+    NEVER,
+    LESS,
+    MORE,
+    ALWAYS
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.examples/bin/META-INF/services/com.oracle.max.graal.extensions.FrameModifier	Fri Jul 08 18:35:51 2011 +0200
@@ -0,0 +1,1 @@
+com.oracle.max.graal.examples.deopt.FrameModifierImpl
\ No newline at end of file
--- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/inlining/InliningGuideImpl.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/inlining/InliningGuideImpl.java	Fri Jul 08 18:35:51 2011 +0200
@@ -31,11 +31,11 @@
     @Override
     public InliningHint getHint(int depth, RiMethod caller, int bci, RiMethod target) {
         if (target.name().equals("neverInline")) {
-            return InliningHint.NEVER_INLINE;
+            return InliningHint.NEVER;
         } else if (target.name().equals("alwaysInline") && depth < 50) {
-            return InliningHint.ALWAYS_INLINE;
+            return InliningHint.ALWAYS;
         } else if (target.name().equals("fib") && depth < 5) {
-            return InliningHint.ALWAYS_INLINE;
+            return InliningHint.ALWAYS;
         }
         return InliningHint.NONE;
     }
--- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/IntrinsifierImpl.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/IntrinsifierImpl.java	Fri Jul 08 18:35:51 2011 +0200
@@ -38,7 +38,7 @@
     public Graph intrinsicGraph(RiRuntime runtime, RiMethod caller, int bci, RiMethod method, List<? extends Node> parameters) {
         if (method.holder().name().equals("Lcom/oracle/max/graal/examples/intrinsics/SafeAddExample;") && method.name().equals("safeAdd")) {
             CompilerGraph graph = new CompilerGraph(runtime);
-            Return returnNode = new Return(new SafeAdd(new Local(CiKind.Long, 0, graph), new Local(CiKind.Long, 1, graph), graph), graph);
+            Return returnNode = new Return(new SafeAddNode(new Local(CiKind.Long, 0, graph), new Local(CiKind.Long, 1, graph), graph), graph);
             graph.start().setNext(returnNode);
             graph.setReturn(returnNode);
             return graph;
--- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAdd.java	Fri Jul 08 18:00:39 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.graal.examples.intrinsics;
-
-import com.oracle.max.graal.compiler.gen.*;
-import com.oracle.max.graal.compiler.ir.*;
-import com.oracle.max.graal.graph.*;
-import com.sun.cri.bytecode.*;
-import com.sun.cri.ci.*;
-
-
-public final class SafeAdd extends IntegerArithmetic {
-    public SafeAdd(Value x, Value y, Graph graph) {
-        super(CiKind.Int, Bytecodes.LADD, x, y, graph);
-    }
-
-    @Override
-    public Node copy(Graph into) {
-        return new SafeAdd(null, null, into);
-    }
-
-    @Override
-    public String shortName() {
-        return "[+]";
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public <T extends Op> T lookup(Class<T> clazz) {
-        if (clazz == LIRGenerator.LIRGeneratorOp.class) {
-            return (T) GENERATOR_OP;
-        }
-        return super.lookup(clazz);
-    }
-
-    private static final LIRGenerator.LIRGeneratorOp GENERATOR_OP = new LIRGenerator.LIRGeneratorOp() {
-        @Override
-        public void generate(Node n, LIRGenerator generator) {
-            SafeAdd add = (SafeAdd) n;
-            generator.arithmeticOpInt(Bytecodes.IADD, generator.createResultVariable(add), generator.load(add.x()), generator.load(add.y()), CiValue.IllegalValue);
-            generator.deoptimizeOn(Condition.OF);
-        }
-    };
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/intrinsics/SafeAddNode.java	Fri Jul 08 18:35:51 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.max.graal.examples.intrinsics;
+
+import com.oracle.max.graal.compiler.gen.*;
+import com.oracle.max.graal.compiler.ir.*;
+import com.oracle.max.graal.graph.*;
+import com.sun.cri.bytecode.*;
+import com.sun.cri.ci.*;
+
+
+public final class SafeAddNode extends IntegerArithmeticNode {
+    public SafeAddNode(Value x, Value y, Graph graph) {
+        super(CiKind.Int, Bytecodes.LADD, x, y, graph);
+    }
+
+    @Override
+    public Node copy(Graph into) {
+        return new SafeAddNode(null, null, into);
+    }
+
+    @Override
+    public String shortName() {
+        return "[+]";
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends Op> T lookup(Class<T> clazz) {
+        if (clazz == LIRGenerator.LIRGeneratorOp.class) {
+            return (T) GENERATOR_OP;
+        }
+        return super.lookup(clazz);
+    }
+
+    private static final LIRGenerator.LIRGeneratorOp GENERATOR_OP = new LIRGenerator.LIRGeneratorOp() {
+        @Override
+        public void generate(Node n, LIRGenerator generator) {
+            SafeAddNode add = (SafeAddNode) n;
+            generator.integerAdd(add, add.x(), add.y());
+            generator.deoptimizeOn(Condition.OF);
+        }
+    };
+}
--- a/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/graal/com.oracle.max.graal.examples/src/com/oracle/max/graal/examples/opt/OptimizerImpl.java	Fri Jul 08 18:35:51 2011 +0200
@@ -36,20 +36,25 @@
 
     @Override
     public void optimize(RiRuntime runtime, Graph graph) {
-        for (SafeAdd safeAdd : graph.getNodes(SafeAdd.class)) {
-            if (safeAdd.y().isConstant() && safeAdd.y().asConstant().asLong() == 1) {
-                if (safeAdd.x() instanceof Phi) {
-                    Phi phi = (Phi) safeAdd.x();
-                    if (phi.merge() instanceof LoopBegin && phi.valueAt(1) == safeAdd) {
-                        LoopBegin loopBegin = (LoopBegin) phi.merge();
-                        if (!canOverflow(phi, loopBegin)) {
-                            IntegerAdd add = new IntegerAdd(CiKind.Int, safeAdd.x(), safeAdd.y(), graph);
-                            safeAdd.replaceAndDelete(add);
-                        }
-                    }
+        for (SafeAddNode safeAdd : graph.getNodes(SafeAddNode.class)) {
+            if (!canOverflow(safeAdd)) {
+                IntegerAdd add = new IntegerAdd(CiKind.Int, safeAdd.x(), safeAdd.y(), graph);
+                safeAdd.replaceAndDelete(add);
+            }
+        }
+    }
+
+    private boolean canOverflow(SafeAddNode safeAdd) {
+        if (safeAdd.y().isConstant() && safeAdd.y().asConstant().asLong() == 1) {
+            if (safeAdd.x() instanceof Phi) {
+                Phi phi = (Phi) safeAdd.x();
+                if (phi.merge() instanceof LoopBegin && phi.valueAt(1) == safeAdd) {
+                    LoopBegin loopBegin = (LoopBegin) phi.merge();
+                    return canOverflow(phi, loopBegin);
                 }
             }
         }
+        return true;
     }
 
     private boolean canOverflow(Phi phi, LoopBegin loopBegin) {
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/StandardGroupOrganizer.java	Fri Jul 08 18:35:51 2011 +0200
@@ -28,6 +28,7 @@
 import com.sun.hotspot.igv.data.services.GroupOrganizer;
 import com.sun.hotspot.igv.data.Pair;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -41,27 +42,17 @@
     }
 
     public List<Pair<String, List<Group>>> organize(List<String> subFolders, List<Group> groups) {
-
         List<Pair<String, List<Group>>> result = new ArrayList<Pair<String, List<Group>>>();
-
         if (groups.size() == 1 && subFolders.size() > 0) {
             result.add(new Pair<String, List<Group>>("", groups));
         } else {
             for (Group g : groups) {
-                List<Group> children = new ArrayList<Group>();
-                children.add(g);
-                if(false && g.getGraphs().size() == 1) {
-                    //g.getGraphs().get(0).setName(g.getName() + " / " + g.getGraphs().get(0).getName());
-                    result.add(new Pair<String, List<Group>>("", children));
-                } else {
-                    Pair<String, List<Group>> p = new Pair<String, List<Group>>();
-                    p.setLeft(g.getName());
-                    p.setRight(children);
-                    result.add(p);
-                }
+                Pair<String, List<Group>> p = new Pair<String, List<Group>>();
+                p.setLeft(g.getName());
+                p.setRight(Arrays.asList(g));
+                result.add(p);
             }
         }
-
         return result;
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java	Fri Jul 08 18:00:39 2011 +0200
+++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java	Fri Jul 08 18:35:51 2011 +0200
@@ -186,6 +186,10 @@
     }
 
     public Collection<InputBlock> schedule(InputGraph graph) {
+        if (graph.getNodes().isEmpty()) {
+            return Collections.emptyList();
+        }
+
         if (graph.getBlocks().size() > 0) {
             Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
             for (InputNode n : tmpNodes) {
@@ -207,7 +211,6 @@
             buildCommonDominators();
             scheduleLatest();
 
-
             InputBlock noBlock = null;
             for (InputNode n : graph.getNodes()) {
                 if (graph.getBlock(n) == null) {
@@ -225,9 +228,7 @@
         }
     }
 
-    public void scheduleLatest() {
-
-
+    private void scheduleLatest() {
         Node root = findRoot();
         if(root == null) {
             assert false : "No root found!";
@@ -552,21 +553,30 @@
     }
 
     private Node findRoot() {
-
+        Node minNode = null;
         Node alternativeRoot = null;
-        for (Node n : nodes) {
-            InputNode inputNode = n.inputNode;
+
+        for (Node node : nodes) {
+            InputNode inputNode = node.inputNode;
             String s = inputNode.getProperties().get("name");
             if (s != null && s.equals("Root")) {
-                return n;
+                return node;
             }
 
-            if (n.preds.size() == 0) {
-                alternativeRoot = n;
+            if (alternativeRoot == null && node.preds.isEmpty()) {
+                alternativeRoot = node;
+            }
+
+            if (minNode == null || node.inputNode.getId() < minNode.inputNode.getId()) {
+                minNode = node;
             }
         }
 
-        return alternativeRoot;
+        if (alternativeRoot != null) {
+            return alternativeRoot;
+        } else {
+            return minNode;
+        }
     }
 
     public void buildUpGraph() {
--- a/src/share/tools/IdealGraphVisualizer/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties	Fri Jul 08 18:00:39 2011 +0200
+++ b/src/share/tools/IdealGraphVisualizer/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties	Fri Jul 08 18:35:51 2011 +0200
@@ -1,7 +1,7 @@
-currentVersion=IdealGraphVisualizer {0}
-LBL_splash_window_title=Starting IdealGraphVisualizer
-SPLASH_WIDTH=475
-SplashProgressBarBounds=0,268,473,6
-SplashProgressBarColor=0xFFFFFF
-SplashRunningTextBounds=10,281,459,12
-SplashRunningTextColor=0xFFFFFF
+currentVersion=IdealGraphVisualizer {0}
+LBL_splash_window_title=Starting IdealGraphVisualizer
+SPLASH_WIDTH=475
+SplashProgressBarBounds=0,273,475,6
+SplashProgressBarColor=0xFFFFFF
+SplashRunningTextBounds=10,283,460,12
+SplashRunningTextColor=0xFFFFFF
Binary file src/share/tools/IdealGraphVisualizer/branding/core/core.jar/org/netbeans/core/startup/frame.gif has changed
Binary file src/share/tools/IdealGraphVisualizer/branding/core/core.jar/org/netbeans/core/startup/splash.gif has changed
--- a/src/share/tools/IdealGraphVisualizer/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties	Fri Jul 08 18:00:39 2011 +0200
+++ b/src/share/tools/IdealGraphVisualizer/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties	Fri Jul 08 18:35:51 2011 +0200
@@ -1,2 +1,2 @@
-CTL_MainWindow_Title=IdealGraphVisualizer {0}
-CTL_MainWindow_Title_No_Project=IdealGraphVisualizer {0}
+CTL_MainWindow_Title=IdealGraphVisualizer
+CTL_MainWindow_Title_No_Project=IdealGraphVisualizer