Mercurial > hg > graal-jvmci-8
changeset 3600:707bc4847b00
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 20 Oct 2011 17:25:50 +0200 |
parents | 9c0748af29c9 (current diff) 9fe4191f46af (diff) |
children | 3822c5969a8b |
files | |
diffstat | 17 files changed, 243 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/Bundle.properties Thu Oct 20 17:25:50 2011 +0200 @@ -1,4 +1,4 @@ -CTL_BytecodeViewAction=Open BytecodeView Window +CTL_BytecodeViewAction=Bytecode CTL_BytecodeViewTopComponent=Bytecode CTL_SelectBytecodesAction=Select nodes HINT_BytecodeViewTopComponent=Shows the bytecode associated with the displayed graph.
--- a/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/Bundle.properties Thu Oct 20 17:25:50 2011 +0200 @@ -1,4 +1,4 @@ -CTL_ControlFlowAction=Open ControlFlow Window +CTL_ControlFlowAction=Control Flow CTL_ControlFlowTopComponent=Control Flow HINT_ControlFlowTopComponent=Shows the blocks of the current graph. OpenIDE-Module-Name=ControlFlow
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java Thu Oct 20 17:25:50 2011 +0200 @@ -79,7 +79,7 @@ List<Node> curNodes = new ArrayList<Node>(); for (Group g : p.getRight()) { - for (InputGraph graph : g.getGraphs()) { + for (InputGraph graph : g.getGraphListCopy()) { curNodes.add(new GraphNode(graph)); } g.getChangedEvent().addListener(this);
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphCountGroupOrganizer.java Thu Oct 20 17:25:50 2011 +0200 @@ -51,7 +51,7 @@ if (subFolders.size() == 0) { Map<Integer, List<Group>> map = new HashMap<Integer, List<Group>>(groups.size()); for (Group g : groups) { - Integer cur = g.getGraphs().size(); + Integer cur = g.getGraphsCount(); if (!map.containsKey(cur)) { map.put(cur, new ArrayList<Group>()); }
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/Bundle.properties Thu Oct 20 17:25:50 2011 +0200 @@ -2,7 +2,7 @@ CTL_OpenGraphAction=View graph CTL_DiffGraphAction=Difference to current graph CTL_RemoveAction=Remove methods -CTL_OutlineAction=Open Outline Window +CTL_OutlineAction=Outline CTL_SaveAsAction=Save selected methods... CTL_SaveAllAction=Save all... CTL_PropertiesAction=Open Properties Window
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java Thu Oct 20 17:25:50 2011 +0200 @@ -47,10 +47,8 @@ import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.openide.util.actions.CallableSystemAction; -import org.openide.xml.XMLUtil; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; /** * @@ -88,7 +86,6 @@ Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); try { - final XMLReader reader = XMLUtil.createXMLReader(); final FileInputStream inputStream = new FileInputStream(file); final InputSource is = new InputSource(inputStream); @@ -123,7 +120,7 @@ public void run() { GraphDocument document = null; try { - document = parser.parse(reader, is, parseMonitor); + document = parser.parse(is, parseMonitor); parseMonitor.setState("Finishing"); component.getDocument().addGraphDocument(document); } catch (SAXException ex) { @@ -140,8 +137,6 @@ } }); - } catch (SAXException ex) { - ex.printStackTrace(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) {
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java Thu Oct 20 17:25:50 2011 +0200 @@ -35,14 +35,15 @@ */ public class Group extends Properties.Entity implements ChangedEventProvider<Group> { - private List<InputGraph> graphs; + private final List<InputGraph> graphs; + private InputMethod method; private String assembly; private transient ChangedEvent<Group> changedEvent; private transient boolean complete = true; public Group() { - graphs = new ArrayList<InputGraph>(); + graphs = Collections.synchronizedList(new ArrayList<InputGraph>()); changedEvent = new ChangedEvent<Group>(this); // Ensure that name and type are never null @@ -86,30 +87,50 @@ return Collections.unmodifiableList(graphs); } + public int getGraphsCount() { + return graphs.size(); + } + + public List<InputGraph> getGraphListCopy() { + synchronized (graphs) { + return new ArrayList<InputGraph>(graphs); + } + } + + public void addGraph(InputGraph graph) { + synchronized (graphs) { + graph.setParent(this, graphs.size()); + graphs.add(graph); + } + changedEvent.fire(); + } + public InputGraph addGraph(String name) { return addGraph(name, null); } public InputGraph addGraph(String name, Pair<InputGraph, InputGraph> pair) { - InputGraph g = new InputGraph(graphs.size(), this, name, pair); - graphs.add(g); + InputGraph g; + synchronized (graphs) { + g = new InputGraph(graphs.size(), this, name, pair); + graphs.add(g); + } changedEvent.fire(); return g; } public void removeGraph(InputGraph g) { - int index = graphs.indexOf(g); - if (index != -1) { - graphs.remove(g); + if (graphs.remove(g)) { changedEvent.fire(); } } public Set<Integer> getAllNodes() { Set<Integer> result = new HashSet<Integer>(); - for (InputGraph g : graphs) { - Set<Integer> ids = g.getNodesAsSet(); - result.addAll(g.getNodesAsSet()); + synchronized (graphs) { + for (InputGraph g : graphs) { + result.addAll(g.getNodesAsSet()); + } } return result; } @@ -118,9 +139,11 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Group " + getProperties().toString() + "\n"); - for (InputGraph g : graphs) { - sb.append(g.toString()); - sb.append("\n"); + synchronized (graphs) { + for (InputGraph g : graphs) { + sb.append(g.toString()); + sb.append('\n'); + } } return sb.toString(); }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java Thu Oct 20 17:25:50 2011 +0200 @@ -49,6 +49,10 @@ private Pair<InputGraph, InputGraph> sourceGraphs; private int parentIndex; + public static InputGraph createWithoutGroup(String name, Pair<InputGraph, InputGraph> sourceGraphs) { + return new InputGraph(-1, null, name, sourceGraphs); + } + InputGraph(int parentIndex, Group parent, String name, Pair<InputGraph, InputGraph> sourceGraphs) { this.parentIndex = parentIndex; this.parent = parent; @@ -60,6 +64,14 @@ blockEdges = new LinkedHashSet<InputBlockEdge>(); nodeToBlock = new LinkedHashMap<Integer, InputBlock>(); } + + public void setParent(Group parent, int parentIndex) { + assert (this.parent == null); + assert (this.parentIndex == -1); + + this.parent = parent; + this.parentIndex = parentIndex; + } public InputBlockEdge addBlockEdge(InputBlock left, InputBlock right) { InputBlockEdge edge = new InputBlockEdge(left, right);
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java Thu Oct 20 17:25:50 2011 +0200 @@ -38,9 +38,15 @@ import com.sun.hotspot.igv.data.serialization.XMLParser.ParseMonitor; import com.sun.hotspot.igv.data.serialization.XMLParser.TopElementHandler; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.SchemaFactory; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; @@ -205,14 +211,12 @@ @Override protected InputGraph start() throws SAXException { - String name = readAttribute(GRAPH_NAME_PROPERTY); - InputGraph curGraph = getParentObject().addGraph(name); + InputGraph curGraph = InputGraph.createWithoutGroup(name, null); if (difference) { - List<InputGraph> list = getParentObject().getGraphs(); - if (list.size() > 1) { - InputGraph previous = list.get(list.size() - 2); + if (list.size() > 0) { + InputGraph previous = list.get(list.size() - 1); for (InputNode n : previous.getNodes()) { curGraph.addNode(n); } @@ -273,6 +277,9 @@ graph.addBlockEdge(left, right); } blockConnections.clear(); + + // Add to group + getParentObject().addGraph(graph); } }; // <nodes> @@ -378,7 +385,7 @@ if (fromIndexString != null) { fromIndex = Integer.parseInt(fromIndexString); } - + String toIndexString = readAttribute(TO_INDEX_PROPERTY); if (toIndexString == null) { toIndexString = readAttribute(TO_INDEX_ALT_PROPERTY); @@ -495,7 +502,9 @@ } // Returns a new GraphDocument object deserialized from an XML input source. - public synchronized GraphDocument parse(XMLReader reader, InputSource source, XMLParser.ParseMonitor monitor) throws SAXException { + public synchronized GraphDocument parse(InputSource source, XMLParser.ParseMonitor monitor) throws SAXException { + XMLReader reader = createReader(); + reader.setContentHandler(new XMLParser(xmlDocument, monitor)); try { reader.parse(source); @@ -505,4 +514,21 @@ return topHandler.getObject(); } + + private XMLReader createReader() throws SAXException { + try { + SAXParserFactory pfactory = SAXParserFactory.newInstance(); + pfactory.setValidating(false); + pfactory.setNamespaceAware(true); + + // Enable schema validation + SchemaFactory sfactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); + InputStream stream = Parser.class.getResourceAsStream("graphdocument.xsd"); + pfactory.setSchema(sfactory.newSchema(new Source[]{new StreamSource(stream)})); + + return pfactory.newSAXParser().getXMLReader(); + } catch (ParserConfigurationException ex) { + throw new SAXException(ex); + } + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/graphdocument.xsd Thu Oct 20 17:25:50 2011 +0200 @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + + <xsd:element name="graphDocument"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="group" type="groupType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="groupType"> + <xsd:sequence> + <xsd:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="assembly" type="assemblyType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="method" type="methodType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="graph" type="graphType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="difference" use="optional" /> + </xsd:complexType> + + <xsd:complexType name="propertiesType"> + <xsd:sequence> + <xsd:element name="p" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="name" use="required" /> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:simpleType name="assemblyType"> + <xsd:restriction base="xsd:string" /> + </xsd:simpleType> + + <xsd:complexType name="methodType"> + <xsd:all> + <xsd:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" /> + <xsd:element name="bytecodes" minOccurs="0" maxOccurs="1"> + <xsd:simpleType> + <xsd:restriction base="xsd:string" /> + </xsd:simpleType> + </xsd:element> + <xsd:element name="inlined" minOccurs="0" maxOccurs="1"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="method" type="methodType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:all> + <xsd:attribute name="bci" type="xsd:int" use="required" /> + <xsd:attribute name="shortName" type="xsd:string" use="required" /> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + + <xsd:complexType name="graphType"> + <xsd:sequence> + <xsd:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" /> + + <xsd:element name="nodes" minOccurs="0" maxOccurs="1"> + <xsd:complexType> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="node" type="nodeType" /> + <xsd:element name="removeNode" type="nodeRefType" /> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="edges" minOccurs="0" maxOccurs="1"> + <xsd:complexType> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="edge" type="edgeType" /> + <xsd:element name="removeEdge" type="edgeType" /> + </xsd:choice> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="controlFlow" type="controlFlowType" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> + + <xsd:attribute name="name" use="optional" /> + </xsd:complexType> + + <xsd:complexType name="nodeType"> + <xsd:sequence> + <xsd:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:int" use="required" /> + </xsd:complexType> + + <xsd:complexType name="nodeRefType"> + <xsd:attribute name="id" type="xsd:int" use="required" /> + </xsd:complexType> + + <xsd:complexType name="edgeType"> + <xsd:attribute name="from" type="xsd:int" use="required" /> + <xsd:attribute name="to" type="xsd:int" use="required" /> + <xsd:attribute name="fromIndex" type="xsd:int" use="optional" /> + + <!-- These are aliases and should be mutually exclusive --> + <xsd:attribute name="toIndex" type="xsd:int" use="optional" /> + <xsd:attribute name="index" type="xsd:int" use="optional" /> + </xsd:complexType> + + <xsd:complexType name="controlFlowType"> + <xsd:sequence> + <xsd:element name="block" type="blockType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="blockType"> + <xsd:all> + <xsd:element name="successors" minOccurs="0" maxOccurs="1"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="successor" minOccurs="0" maxOccurs="unbounded"> + <xsd:complexType> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="nodes" minOccurs="0" maxOccurs="1"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="node" type="nodeRefType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:all> + + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> +</xsd:schema>
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/Util.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/Util.java Thu Oct 20 17:25:50 2011 +0200 @@ -70,7 +70,7 @@ public static void assertGroupEquals(Group a, Group b) { - if (a.getGraphs().size() != b.getGraphs().size()) { + if (a.getGraphsCount() != b.getGraphsCount()) { fail(); }
--- a/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/serialization/ParserTest.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/Data/test/unit/src/com/sun/hotspot/igv/data/serialization/ParserTest.java Thu Oct 20 17:25:50 2011 +0200 @@ -40,11 +40,9 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.openide.xml.XMLUtil; import static org.junit.Assert.*; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; /** * @@ -84,9 +82,8 @@ InputSource is = new InputSource(sr); try { - XMLReader reader = XMLUtil.createXMLReader(); Parser parser = new Parser(); - final GraphDocument parsedDocument = parser.parse(reader, is, null); + final GraphDocument parsedDocument = parser.parse(is, null); Util.assertGraphDocumentEquals(document, parsedDocument); } catch (SAXException ex) { fail(ex.toString());
--- a/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/Bundle.properties Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/FilterWindow/src/com/sun/hotspot/igv/filterwindow/actions/Bundle.properties Thu Oct 20 17:25:50 2011 +0200 @@ -1,4 +1,4 @@ -CTL_FilterAction=Open Filter Window +CTL_FilterAction=Filters CTL_MoveFilterUpAction=Move upwards CTL_MoveFilterDownAction=Move downwards CTL_RemoveFilterAction=Remove
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/Bundle.properties Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/Bundle.properties Thu Oct 20 17:25:50 2011 +0200 @@ -1,4 +1,4 @@ -CTL_TextAction=Open Text Window +CTL_TextAction=Text CTL_TextTopComponent=Text HINT_TextTopComponent=Shows a textual representation of the graph. OpenIDE-Module-Name=GraphTextEditor
--- a/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Client.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/NetworkConnection/src/com/sun/hotspot/igv/connection/Client.java Thu Oct 20 17:25:50 2011 +0200 @@ -33,10 +33,8 @@ import java.net.Socket; import javax.swing.JTextField; import org.openide.util.Exceptions; -import org.openide.xml.XMLUtil; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; /** * @@ -65,9 +63,8 @@ InputSource is = new InputSource(inputStream); try { - XMLReader reader = XMLUtil.createXMLReader(); Parser parser = new Parser(this); - parser.parse(reader, is, null); + parser.parse(is, null); } catch (SAXException ex) { ex.printStackTrace(); }
--- a/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/ServerCompiler/src/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java Thu Oct 20 17:25:50 2011 +0200 @@ -111,7 +111,12 @@ p = parent; break; } + p = p.preds.get(0); + if (p == proj) { + // Cycle, stop + break; + } if (p.block == null) { p.block = block;
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java Thu Oct 20 17:25:37 2011 +0200 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java Thu Oct 20 17:25:50 2011 +0200 @@ -294,7 +294,7 @@ } }); - if (diagram.getGraph().getGroup().getGraphs().size() == 1) { + if (diagram.getGraph().getGroup().getGraphsCount() == 1) { rangeSlider.setVisible(false); }