Mercurial > hg > graal-compiler
changeset 3193:52087773be5b
IdealGraphVisualizer: Make scheduling more robust by ignoring graphs without any nodes and by using the node with the lowest id as root when there is no node labeled "Root" and no node without predecessors
author | Peter Hofer <peter.hofer@jku.at> |
---|---|
date | Fri, 08 Jul 2011 14:26:12 +0200 |
parents | f328020ca67f |
children | 2bc8c1134534 |
files | src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java |
diffstat | 1 files changed, 21 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Fri Jul 08 11:56:25 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Fri Jul 08 14:26:12 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() {