# HG changeset patch # User Peter Hofer # Date 1308583815 -7200 # Node ID 963174f9cd8e115a567699c7f48cfe985583f50d # Parent 7f807764e7fc365a9eda1ae1209b7ee26d77a5fc IdealGraphVisualizer: add textual representation and coloring scheme for the Graal compiler and remove Maxine-specific code diff -r 7f807764e7fc -r 963174f9cd8e graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Mon Jun 20 14:29:16 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Mon Jun 20 17:30:15 2011 +0200 @@ -87,7 +87,7 @@ */ public void beginGroup(String name, String shortName, int bci) { stream.println(""); - stream.printf("

%s

%n", escape(name)); + stream.printf("

%s

Graal

%n", escape(name)); stream.printf(" %n", escape(name), escape(shortName), bci); } diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/build.xml Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,8 @@ + + + + + + Builds, tests, and runs the project com.sun.hotspot.igv.graal. + + diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/manifest.mf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/manifest.mf Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +OpenIDE-Module: com.sun.hotspot.igv.graal +OpenIDE-Module-Layer: com/sun/hotspot/igv/graal/layer.xml +OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/graal/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 + diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/nbproject/build-impl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/build-impl.xml Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + You must set 'suite.dir' to point to your containing module suite + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/genfiles.properties Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=abfbe04d +build.xml.script.CRC32=3534d355 +build.xml.stylesheet.CRC32=a56c6a5b@1.45.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=abfbe04d +nbproject/build-impl.xml.script.CRC32=2867f2d5 +nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.properties Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/project.xml Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,45 @@ + + + org.netbeans.modules.apisupport.project + + + com.sun.hotspot.igv.graal + + + + com.sun.hotspot.igv.data + + + + 1.0 + + + + com.sun.hotspot.igv.graph + + + + 1.0 + + + + com.sun.hotspot.igv.graphtotext + + + + 1.0 + + + + com.sun.hotspot.igv.structuredtext + + + + 1.0 + + + + + + + diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/nbproject/suite.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/nbproject/suite.properties Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,1 @@ +suite.dir=${basedir}/.. diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,1 @@ +com.sun.hotspot.igv.graal.GraalGraphToTextConverter \ No newline at end of file diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/Bundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/Bundle.properties Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,1 @@ +OpenIDE-Module-Name=Graal Compiler Support diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/GraalGraphToTextConverter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/GraalGraphToTextConverter.java Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,209 @@ +/* + * Copyright (c) 1998, 2007, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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.sun.hotspot.igv.graal; + +import com.sun.hotspot.igv.data.InputBlock; +import com.sun.hotspot.igv.data.InputEdge; +import com.sun.hotspot.igv.data.InputGraph; +import com.sun.hotspot.igv.data.InputNode; +import com.sun.hotspot.igv.data.Properties; +import com.sun.hotspot.igv.data.Properties.PropertyMatcher; +import com.sun.hotspot.igv.graph.Diagram; +import com.sun.hotspot.igv.graph.Figure; +import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter; +import com.sun.hotspot.igv.structuredtext.Element; +import com.sun.hotspot.igv.structuredtext.MultiElement; +import com.sun.hotspot.igv.structuredtext.SimpleElement; +import com.sun.hotspot.igv.structuredtext.StructuredText; +import java.awt.Color; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.swing.text.Style; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; + +/** + * @author Peter Hofer + * @author Thomas Wuerthinger + */ +public class GraalGraphToTextConverter implements GraphToTextConverter { + + private Map> map; + private Map> incomingEdges; + private Map> outgoingEdges; + private InputGraph graph; + + private Collection sortNodes(Collection nodes) { + List result = new ArrayList(nodes); + Collections.sort(result, InputNode.getPropertyComparator("idx")); + return result; + } + + public StructuredText convert(InputGraph graph, Diagram diagram) { + + this.graph = graph; + map = diagram.calcSourceToFigureRelation(); + + incomingEdges = graph.findAllIngoingEdges(); + outgoingEdges = graph.findAllOutgoingEdges(); + + final StructuredText result = new StructuredText(graph.getName()); + + for (InputBlock b : graph.getBlocks()) { + result.addChild(new SimpleElement("Block " + b.getName() + "\n")); + for (InputNode n : sortNodes(b.getNodes())) { + result.addChild(getNodeElement(n)); + } + } + + boolean first = true; + for (InputNode n : sortNodes(graph.getNodes())) { + if (graph.getBlock(n) == null) { + if (first) { + first = false; + result.addChild(new SimpleElement("No block: \n")); + } + result.addChild(getNodeElement(n)); + } + } + + return result; + } + + private Element getNodeNameElement(InputNode n) { + + final SimpleElement name = new SimpleElement(n.getProperties().get("idx") + " " + n.getProperties().get("name"), calcStyle(n)); + name.addSource(n.getId()); + return name; + } + + private Element getNodeShortElement(InputNode n) { + final SimpleElement id = new SimpleElement(n.getProperties().get("idx"), calcStyle(n)); + id.addSource(n.getId()); + return id; + } + + private Element getNodeElement(InputNode n) { + + final MultiElement result = new MultiElement(); + + result.print("\t"); + result.addChild(getNodeNameElement(n)); + + result.print(" :::"); + + // NOTE: lists in ingoingEdges/outgoingEdges are sorted by from/to slot + // and for slots that are connected with multiple edges, by + // from/to node + + int succCount = Integer.parseInt(n.getProperties().get("successorCount")); + InputEdge[] outgoing = outgoingEdges.get(n).toArray(new InputEdge[0]); + + int i = 0; + if (outgoing.length > 0 && outgoing[0].getFromIndex() < succCount) { + // Node has successors (each connected to a different slot) + result.print(" Succ = ["); + while (i < outgoing.length && outgoing[i].getFromIndex() < succCount) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(outgoing[i].getTo()))); + result.print(" "); + i++; + } + result.print("]"); + } + if (i < outgoing.length) { + // Node has usages (all connected to a single slot) + result.print(" Usages = ["); + while (i < outgoing.length) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(outgoing[i].getTo()))); + result.print(" "); + i++; + } + result.print("]"); + } + + int predCount = Integer.parseInt(n.getProperties().get("predecessorCount")); + InputEdge[] incoming = incomingEdges.get(n).toArray(new InputEdge[0]); + + int j = 0; + if (incoming.length > 0 && incoming[0].getToIndex() < predCount) { + // Node has predecessors (each connected to a different slot) + result.print(" Pred = ["); + while (j < incoming.length && incoming[j].getToIndex() < predCount) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(incoming[j].getFrom()))); + result.print(" "); + j++; + } + result.print("]"); + } + if (j < incoming.length) { + // Node has inputs (each connected to a different slot) + result.print(" Inputs = ["); + while (j < incoming.length) { + result.print(" "); + result.addChild(getNodeShortElement(graph.getNode(incoming[j].getFrom()))); + result.print(" "); + j++; + } + result.print("]"); + } + + result.print("\n"); + return result; + } + private static final PropertyMatcher MATCHER = new Properties.StringPropertyMatcher("origin", "Graal"); + + public boolean canConvert(InputGraph graph) { + return graph.getGroup().getProperties().selectSingle(MATCHER) != null; + } + + private Color calcColor(InputNode node) { + Set
figureSet = this.map.get(node); + if (figureSet != null && figureSet.size() == 1) { + return figureSet.iterator().next().getColor(); + } else { + return Color.WHITE; + } + } + + private Color lessColor(Color c) { + return new Color(255 - (255 - c.getRed()) / 4, 255 - (255 - c.getGreen()) / 4, 255 - (255 - c.getBlue()) / 4); + } + + private Style calcStyle(InputNode node) { + Color c = calcColor(node); + Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); + Style newStyle = StyleContext.getDefaultStyleContext().addStyle(null, defaultStyle); + + StyleConstants.setBackground(newStyle, lessColor(c)); + return newStyle; + } +} diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/color.filter --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/filters/color.filter Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,9 @@ +colorize("name", ".*", white); +colorize("name", "StartNode|EndNode|LoopBegin|LoopEnd|Return", red); +colorize("name", "Phi:.*", magenta); +colorize("name", "FrameState@.*", new java.awt.Color(0.5, 0.8, 1.0)); +colorize("name", "If", pink); +colorize("name", "const.*", new java.awt.Color(0.7, 0.7, 0.7)); +colorize("name", "Local", new java.awt.Color(0.85, 0.85, 0.85)); +colorize("name", "\\+|-|\\*|/", cyan); +colorize("name", "Comp .*", yellow); \ No newline at end of file diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Graal/src/com/sun/hotspot/igv/graal/layer.xml Mon Jun 20 17:30:15 2011 +0200 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/build.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/build.xml Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - Builds, tests, and runs the project com.sun.hotspot.igv.maxine. - - diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/manifest.mf --- a/src/share/tools/IdealGraphVisualizer/Maxine/manifest.mf Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.maxine -OpenIDE-Module-Layer: com/sun/hotspot/igv/maxine/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/maxine/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/nbproject/build-impl.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/build-impl.xml Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - - - - - - - - - - - You must set 'suite.dir' to point to your containing module suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/nbproject/genfiles.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/genfiles.properties Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=44af392c -nbproject/build-impl.xml.script.CRC32=1a1fcc4d -nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.45.1 diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.properties Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -javac.source=1.5 -javac.compilerargs=-Xlint -Xlint:-serial diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/project.xml Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ - - - org.netbeans.modules.apisupport.project - - - com.sun.hotspot.igv.maxine - - - - com.sun.hotspot.igv.data - - - - 1.0 - - - - com.sun.hotspot.igv.graph - - - - 1.0 - - - - com.sun.hotspot.igv.graphtotext - - - - 1.0 - - - - com.sun.hotspot.igv.structuredtext - - - - 1.0 - - - - - - - diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/nbproject/suite.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/nbproject/suite.properties Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -suite.dir=${basedir}/.. diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/META-INF/services/com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.sun.hotspot.igv.maxine.CirGraphToTextConverter \ No newline at end of file diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/Bundle.properties --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/Bundle.properties Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -OpenIDE-Module-Name=Maxine diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/CirGraphToTextConverter.java --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/CirGraphToTextConverter.java Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright (c) 1998, 2007, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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.sun.hotspot.igv.maxine; - -import com.sun.hotspot.igv.data.InputEdge; -import com.sun.hotspot.igv.data.InputGraph; -import com.sun.hotspot.igv.data.InputNode; -import com.sun.hotspot.igv.data.Pair; -import com.sun.hotspot.igv.data.Properties; -import com.sun.hotspot.igv.data.Properties.PropertyMatcher; -import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher; -import com.sun.hotspot.igv.data.Properties.StringPropertyMatcher; -import com.sun.hotspot.igv.graph.Diagram; -import com.sun.hotspot.igv.graph.Figure; -import com.sun.hotspot.igv.graphtotext.BFSGraphToTextConverter; -import com.sun.hotspot.igv.graphtotext.services.AbstractGraphToTextVisitor; -import com.sun.hotspot.igv.graphtotext.services.GraphToTextConverter; -import com.sun.hotspot.igv.graphtotext.services.GraphToTextVisitor; -import com.sun.hotspot.igv.structuredtext.Element; -import com.sun.hotspot.igv.structuredtext.MultiElement; -import com.sun.hotspot.igv.structuredtext.SimpleElement; -import com.sun.hotspot.igv.structuredtext.StructuredText; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.swing.text.Style; -import javax.swing.text.StyleConstants; -import javax.swing.text.StyleContext; - -/** - * - * @author Thomas Wuerthinger - */ -public class CirGraphToTextConverter implements GraphToTextConverter { - - private static final String CALL_OPERATOR = " \u2022 "; - - private Map> map; - private InputGraph graph; - - public StructuredText convert(InputGraph graph, Diagram diagram) { - map = diagram.calcSourceToFigureRelation(); - this.graph = graph; - - BFSGraphToTextConverter converter = new BFSGraphToTextConverter(nodeVisitor); - converter.registerVisitor(localVariableVisitor, new StringPropertyMatcher("type", "LocalVariable")); - converter.registerVisitor(parameterVisitor, new StringPropertyMatcher("type", "Parameter")); - converter.registerVisitor(closureVisitor, new RegexpPropertyMatcher("type", "Closure")); - converter.registerVisitor(continuationVisitor, new RegexpPropertyMatcher("type", "Continuation")); - converter.registerVisitor(callVisitor, new RegexpPropertyMatcher("type", "Call")); - converter.registerVisitor(blockVisitor, new RegexpPropertyMatcher("type", "Block")); - return converter.convert(graph, diagram); - } - private GraphToTextVisitor nodeVisitor = new NodeVisitor(); - private GraphToTextVisitor localVariableVisitor = new NodeVisitor(); - private GraphToTextVisitor parameterVisitor = new NodeVisitor(); - private GraphToTextVisitor closureVisitor = new ClosureVisitor("proc"); - private GraphToTextVisitor continuationVisitor = new ClosureVisitor("cont"); - private GraphToTextVisitor callVisitor = new CallVisitor(); - private GraphToTextVisitor blockVisitor = new BlockVisitor(); - - private void printOffset(List path, MultiElement elem) { - for (int i = 0; i < path.size(); i++) { - InputEdge cur = path.get(i); - InputNode fromNode = graph.getNode(cur.getFrom()); - SimpleElement simpleElem = new SimpleElement(" ", calcStyle(fromNode)); - simpleElem.addSource(fromNode.getId()); - elem.addChild(simpleElem); - } - } - - private class NodeVisitor extends AbstractGraphToTextVisitor { - - @Override - public Element cyclicVisit(InputNode node, List path) { - SimpleElement elem = new SimpleElement(node.getProperties().get("name"), calcStyle(node)); - elem.addSource(node.getId()); - return elem; - } - } - - private Color calcColor(InputNode node) { - Set
figureSet = this.map.get(node); - if(figureSet != null && figureSet.size() == 1) { - return figureSet.iterator().next().getColor(); - } else { - return Color.WHITE; - } - } - - private Style calcStyle(InputNode node) { - Color c = calcColor(node); - Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); - Style newStyle = StyleContext.getDefaultStyleContext().addStyle(null, defaultStyle); - - StyleConstants.setBackground(newStyle, c); - return newStyle; - } - - private class ClosureVisitor extends AbstractGraphToTextVisitor { - - private String label; - - protected String getLabel(InputNode node) { - return label; - } - - public ClosureVisitor(String label) { - this.label = label; - } - - @Override - public Element cyclicVisit(InputNode node, List path) { - return SimpleElement.EMPTY; - } - - @Override - public Element visit(InputNode node, List path, List> children) { - MultiElement e = new MultiElement(calcStyle(node)); - e.print("{", node.getId()); - e.print(getLabel(node), node.getId()); - - e.print("[", node.getId()); - for (int i = 0; i < children.size() - 1; i++) { - Pair p = children.get(i); - e.addChild(p.getRight()); - if (i != children.size() - 2) { - e.print("|", node.getId()); - } - } - e.print("]", node.getId()); - e.print(CALL_OPERATOR, node.getId()); - e.println(); - List newPath = new ArrayList(path); - newPath.add(children.get(children.size() - 1).getLeft()); - printOffset(newPath, e); - - MultiElement childElement = new MultiElement("..."); - childElement.addChild(children.get(children.size() - 1).getRight()); - e.addChild(childElement); - - e.println(); - printOffset(path, e); - e.print("}", node.getId()); - MultiElement resElem = new MultiElement(); - resElem.addChild(e); - return resElem; - } - } - - private class CallVisitor extends AbstractGraphToTextVisitor { - - @Override - public Element cyclicVisit(InputNode node, List path) { - return SimpleElement.EMPTY; - } - - @Override - public Element visit(InputNode node, List path, List> children) { - MultiElement e = new MultiElement(calcStyle(node)); - e.print("(", node.getId()); - for (int i = 0; i < children.size(); i++) { - Pair p = children.get(i); - e.addChild(p.getRight()); - if (i != children.size() - 1) { - e.print("|", node.getId()); - } - } - e.print(")", node.getId()); - MultiElement resElem = new MultiElement(); - resElem.addChild(e); - return resElem; - } - } - - private class BlockVisitor extends ClosureVisitor { - - public BlockVisitor() { - super("block"); - } - - @Override - protected String getLabel(InputNode node) { - return node.getProperties().get("name"); - } - - @Override - public Element cyclicVisit(InputNode node, List path) { - MultiElement e = new MultiElement(calcStyle(node)); - e.print(getLabel(node), node); - return e; - } - - @Override - public Element visit(InputNode node, List path, List> children) { - return super.visit(node, path, children); - } - } - - private static final PropertyMatcher MATCHER = new Properties.RegexpPropertyMatcher("type", ".*CIR.*"); - public boolean canConvert(InputGraph graph) { - return graph.getGroup().getProperties().selectSingle(MATCHER) != null; - } -} diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/color.filter --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/color.filter Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -colorize("name", ".*", white); -colorize("name", "cont",new java.awt.Color(1.0, 0.8, 0.8)); -colorize("name", "proc", new java.awt.Color(0.8, 0.8, 1.0)); -colorize("name", "call", new java.awt.Color(0.9, 0.9, 0.9)); -colorize("name", "block", new java.awt.Color(1.0, 1.0, 0.6)); -colorize("class", ".*Constant", new java.awt.Color(0.7, 1.0, 0.9)); -colorize("class", ".*Parameter", new java.awt.Color(0.9, 1.0, 0.7)); -colorize("class", ".*Variable", new java.awt.Color(0.7, 1.0, 0.7)); -colorize("class", ".*cir\.snippet.*", yellow); \ No newline at end of file diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/structural.filter --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/filters/structural.filter Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -split("class", ".*Constant"); -split("class", ".*Variable"); -split("class", ".*Parameter"); -split("class", ".*Snippet"); -split("class", ".*Switch"); -split("class", ".*cir\.snippet.*"); -split("class", ".*cir\.builtin.*"); \ No newline at end of file diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/layer.xml --- a/src/share/tools/IdealGraphVisualizer/Maxine/src/com/sun/hotspot/igv/maxine/layer.xml Mon Jun 20 14:29:16 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff -r 7f807764e7fc -r 963174f9cd8e src/share/tools/IdealGraphVisualizer/nbproject/project.properties --- a/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Mon Jun 20 14:29:16 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/nbproject/project.properties Mon Jun 20 17:30:15 2011 +0200 @@ -21,12 +21,12 @@ ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ ${project.com.sun.hotspot.igv.filterwindow}:\ ${project.com.sun.hotspot.igv.graphtotext}:\ - ${project.com.sun.hotspot.igv.maxine}:\ ${project.com.sun.hotspot.igv.java6scriptingproxy}:\ ${project.com.sun.hotspot.igv.graphtexteditor}:\ ${project.com.sun.hotspot.igv.structuredtext}:\ ${project.com.sun.hotspot.igv.texteditor}:\ - ${project.com.sun.hotspot.igv.selectioncoordinator} + ${project.com.sun.hotspot.igv.selectioncoordinator}:\ + ${project.com.sun.hotspot.igv.graal} project.com.sun.hotspot.connection=NetworkConnection project.com.sun.hotspot.igv.bytecodes=Bytecodes project.com.sun.hotspot.igv.controlflow=ControlFlow @@ -35,13 +35,13 @@ project.com.sun.hotspot.igv.difference=Difference project.com.sun.hotspot.igv.filter=Filter project.com.sun.hotspot.igv.filterwindow=FilterWindow +project.com.sun.hotspot.igv.graal=Graal project.com.sun.hotspot.igv.graph=Graph project.com.sun.hotspot.igv.graphtexteditor=GraphTextEditor project.com.sun.hotspot.igv.graphtotext=GraphToText project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout project.com.sun.hotspot.igv.java6scriptingproxy=Java6ScriptingProxy project.com.sun.hotspot.igv.layout=Layout -project.com.sun.hotspot.igv.maxine=Maxine project.com.sun.hotspot.igv.rhino=RhinoScriptEngineProxy project.com.sun.hotspot.igv.selectioncoordinator=SelectionCoordinator project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler