com.sun.hotspot.igv.data.InputGraph Java Examples

The following examples show how to use com.sun.hotspot.igv.data.InputGraph. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Printer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void export(XMLWriter writer, Group g) throws IOException {
    Properties attributes = new Properties();
    attributes.setProperty("difference", Boolean.toString(true));
    writer.startTag(Parser.GROUP_ELEMENT, attributes);
    writer.writeProperties(g.getProperties());

    if (g.getMethod() != null) {
        export(writer, g.getMethod());
    }

    InputGraph previous = null;
    for (InputGraph graph : g.getGraphs()) {
        export(writer, graph, previous, true);
        previous = graph;
    }

    writer.endTag();
}
 
Example #2
Source File: Difference.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static InputGraph createDiffSameGroup(InputGraph a, InputGraph b) {
    Map<Integer, InputNode> keyMapB = new HashMap<Integer, InputNode>();
    for (InputNode n : b.getNodes()) {
        Integer key = n.getId();
        assert !keyMapB.containsKey(key);
        keyMapB.put(key, n);
    }

    Set<Pair> pairs = new HashSet<Pair>();

    for (InputNode n : a.getNodes()) {
        Integer key = n.getId();


        if (keyMapB.containsKey(key)) {
            InputNode nB = keyMapB.get(key);
            pairs.add(new Pair(n, nB));
        }
    }

    return createDiff(a, b, pairs);
}
 
Example #3
Source File: GraphNode.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public <T extends Node.Cookie> T getCookie(Class<T> aClass) {
    if (aClass == DiffGraphCookie.class) {
        InputGraphProvider graphProvider = Utilities.actionsGlobalContext().lookup(InputGraphProvider.class);

        InputGraph graphA = null;
        if (graphProvider != null) {
            graphA = graphProvider.getGraph();
        }

        if (graphA != null && !graphA.isDifferenceGraph()) {
            return (T) new DiffGraphCookie(graphA, graph);
        }
    }

    return super.getCookie(aClass);
}
 
Example #4
Source File: GraphNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private GraphNode(final InputGraph graph, InstanceContent content) {
    super(Children.LEAF, new AbstractLookup(content));
    this.graph = graph;
    this.setDisplayName(graph.getName());
    content.add(graph);

    final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class);

    if (viewer != null) {
        // Action for opening the graph
        content.add(new OpenCookie() {

            public void open() {
                viewer.view(graph);
            }
        });
    }

    // Action for removing a graph
    content.add(new RemoveCookie() {

        public void remove() {
            graph.getGroup().removeGraph(graph);
        }
    });
}
 
Example #5
Source File: Printer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void export(XMLWriter writer, Group g) throws IOException {
    Properties attributes = new Properties();
    attributes.setProperty("difference", Boolean.toString(true));
    writer.startTag(Parser.GROUP_ELEMENT, attributes);
    writer.writeProperties(g.getProperties());

    if (g.getMethod() != null) {
        export(writer, g.getMethod());
    }

    InputGraph previous = null;
    for (InputGraph graph : g.getGraphs()) {
        export(writer, graph, previous, true);
        previous = graph;
    }

    writer.endTag();
}
 
Example #6
Source File: BytecodeNode.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public BytecodeNode(InputBytecode bytecode, InputGraph graph, String bciValue) {

        super(Children.LEAF);
        this.setDisplayName(bytecode.getBci() + " " + bytecode.getName());

        bciValue = bytecode.getBci() + " " + bciValue;
        bciValue = bciValue.trim();

        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<InputNode>(graph.getNodes());
        StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue);
        List<InputNode> nodeList = selector.selectMultiple(matcher);
        if (nodeList.size() > 0) {
            nodes = new HashSet<InputNode>();
            for (InputNode n : nodeList) {
                nodes.add(n);
            }
            this.setDisplayName(this.getDisplayName() + " (" + nodes.size() + " nodes)");
        }
    }
 
Example #7
Source File: BytecodeNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public BytecodeNode(InputBytecode bytecode, InputGraph graph, String bciValue) {

        super(Children.LEAF);
        this.setDisplayName(bytecode.getBci() + " " + bytecode.getName());

        bciValue = bytecode.getBci() + " " + bciValue;
        bciValue = bciValue.trim();

        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<InputNode>(graph.getNodes());
        StringPropertyMatcher matcher = new StringPropertyMatcher("bci", bciValue);
        List<InputNode> nodeList = selector.selectMultiple(matcher);
        if (nodeList.size() > 0) {
            nodes = new HashSet<InputNode>();
            for (InputNode n : nodeList) {
                nodes.add(n);
            }
            this.setDisplayName(this.getDisplayName() + " (" + nodes.size() + " nodes)");
        }
    }
 
Example #8
Source File: NodeQuickSearch.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private List<InputNode> findMatches(String name, String value, InputGraph inputGraph, SearchResponse response) {
    try {
        RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE);
        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(inputGraph.getNodes());
        List<InputNode> matches = selector.selectMultiple(matcher);
        return matches.size() == 0 ? null : matches;
    } catch (Exception e) {
        final String msg = e.getMessage();
        response.addResult(new Runnable() {
            @Override
            public void run() {
                Message desc = new NotifyDescriptor.Message("An exception occurred during the search, "
                        + "perhaps due to a malformed query string:\n" + msg,
                        NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(desc);
            }
        },
                "(Error during search)"
        );
    }
    return null;
}
 
Example #9
Source File: Difference.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static InputGraph createDiffSameGroup(InputGraph a, InputGraph b) {
    Map<Integer, InputNode> keyMapB = new HashMap<Integer, InputNode>();
    for (InputNode n : b.getNodes()) {
        Integer key = n.getId();
        assert !keyMapB.containsKey(key);
        keyMapB.put(key, n);
    }

    Set<Pair> pairs = new HashSet<Pair>();

    for (InputNode n : a.getNodes()) {
        Integer key = n.getId();


        if (keyMapB.containsKey(key)) {
            InputNode nB = keyMapB.get(key);
            pairs.add(new Pair(n, nB));
        }
    }

    return createDiff(a, b, pairs);
}
 
Example #10
Source File: ControlFlowScene.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void setGraph(InputGraph g) {
    if (g == oldGraph) {
        return;
    }
    oldGraph = g;

    ArrayList<InputBlock> blocks = new ArrayList<InputBlock>(this.getNodes());
    for (InputBlock b : blocks) {
        removeNode(b);
    }

    ArrayList<InputBlockEdge> edges = new ArrayList<InputBlockEdge>(this.getEdges());
    for (InputBlockEdge e : edges) {
        removeEdge(e);
    }

    for (InputBlock b : g.getBlocks()) {
        addNode(b);
    }

    for (InputBlock b : g.getBlocks()) {
        for (InputBlockEdge e : b.getOutputs()) {
            addEdge(e);
            assert g.getBlocks().contains(e.getFrom());
            assert g.getBlocks().contains(e.getTo());
            this.setEdgeSource(e, e.getFrom());
            this.setEdgeTarget(e, e.getTo());
        }
    }

    GraphLayout layout = new HierarchicalGraphLayout();//GridGraphLayout();
    SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout);
    sceneLayout.invokeLayout();

    this.validate();
}
 
Example #11
Source File: MethodNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void update(InputGraph graph, InputMethod method) {
    ((MethodNodeChildren) this.getChildren()).setMethod(method, graph);
    if (method != null) {
        this.setDisplayName(method.getName());
    }

}
 
Example #12
Source File: ControlFlowTopComponent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void resultChanged(LookupEvent lookupEvent) {

        final InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class);
        if (p != null) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
            InputGraph g = p.getGraph();
            if (g != null) {
                scene.setGraph(g);
            }
        }
            });
        }
    }
 
Example #13
Source File: Parser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputBlock start() throws SAXException {
    InputGraph graph = getParentObject();
    String name = readRequiredAttribute(BLOCK_NAME_PROPERTY).intern();
    InputBlock b = new InputBlock(getParentObject(), name);
    graph.addBlock(b);
    return b;
}
 
Example #14
Source File: MethodNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of MethodNode */
public MethodNode(InputMethod method, InputGraph graph, String bciString) {
    super((method != null && method.getBytecodes().size() == 0) ? Children.LEAF : new MethodNodeChildren(method, graph, bciString));
    if (method != null) {
        this.setDisplayName(method.getName());
    }
}
 
Example #15
Source File: MethodNode.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of MethodNode */
public MethodNode(InputMethod method, InputGraph graph, String bciString) {
    super((method != null && method.getBytecodes().size() == 0) ? Children.LEAF : new MethodNodeChildren(method, graph, bciString));
    if (method != null) {
        this.setDisplayName(method.getName());
    }
}
 
Example #16
Source File: Source.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean isInBlock(InputGraph g, InputBlock blockNode) {

        for (InputNode n : this.getSourceNodes()) {
            if (g.getBlock(n) == blockNode) {
                return true;
            }
        }
        return false;
    }
 
Example #17
Source File: Source.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean isInBlock(InputGraph g, InputBlock blockNode) {

        for (InputNode n : this.getSourceNodes()) {
            if (g.getBlock(n) == blockNode) {
                return true;
            }
        }
        return false;
    }
 
Example #18
Source File: Parser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputGraph start() throws SAXException {

    String name = readAttribute(GRAPH_NAME_PROPERTY);
    InputGraph previous = getParentObject().getLastAdded();
    if (!difference) {
        previous = null;
    }
    InputGraph curGraph = new InputGraph(getParentObject(), previous, name);
    this.graph = curGraph;
    return curGraph;
}
 
Example #19
Source File: MethodNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of MethodNode */
public MethodNode(InputMethod method, InputGraph graph, String bciString) {
    super((method != null && method.getBytecodes().size() == 0) ? Children.LEAF : new MethodNodeChildren(method, graph, bciString));
    if (method != null) {
        this.setDisplayName(method.getName());
    }
}
 
Example #20
Source File: MethodNode.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void update(InputGraph graph, InputMethod method) {
    ((MethodNodeChildren) this.getChildren()).setMethod(method, graph);
    if (method != null) {
        this.setDisplayName(method.getName());
    }

}
 
Example #21
Source File: ControlFlowScene.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void setGraph(InputGraph g) {
    if (g == oldGraph) {
        return;
    }
    oldGraph = g;

    ArrayList<InputBlock> blocks = new ArrayList<InputBlock>(this.getNodes());
    for (InputBlock b : blocks) {
        removeNode(b);
    }

    ArrayList<InputBlockEdge> edges = new ArrayList<InputBlockEdge>(this.getEdges());
    for (InputBlockEdge e : edges) {
        removeEdge(e);
    }

    for (InputBlock b : g.getBlocks()) {
        addNode(b);
    }

    for (InputBlock b : g.getBlocks()) {
        for (InputBlockEdge e : b.getOutputs()) {
            addEdge(e);
            assert g.getBlocks().contains(e.getFrom());
            assert g.getBlocks().contains(e.getTo());
            this.setEdgeSource(e, e.getFrom());
            this.setEdgeTarget(e, e.getTo());
        }
    }

    GraphLayout layout = new HierarchicalGraphLayout();//GridGraphLayout();
    SceneLayout sceneLayout = LayoutFactory.createSceneGraphLayout(this, layout);
    sceneLayout.invokeLayout();

    this.validate();
}
 
Example #22
Source File: ServerCompilerScheduler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Collection<InputBlock> schedule(InputGraph graph) {
    if (graph.getBlocks().size() > 0) {
        Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
        for (InputNode n : tmpNodes) {
            String block = getBlockName(n);
            if (graph.getBlock(n) == null) {
                graph.getBlock(block).addNode(n);
                assert graph.getBlock(n) != null;
            }
        }
        return graph.getBlocks();
    } else {
        nodes = new ArrayList<Node>();
        inputNodeToNode = new HashMap<InputNode, Node>();

        this.graph = graph;
        buildUpGraph();
        buildBlocks();
        buildDominators();
        buildCommonDominators();
        scheduleLatest();

        for (InputNode n : graph.getNodes()) {
            assert graph.getBlock(n) != null;
        }

        return blocks;
    }
}
 
Example #23
Source File: DiagramViewModel.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static List<String> calculateStringList(Group g) {
    List<String> result = new ArrayList<String>();
    for (InputGraph graph : g.getGraphs()) {
        result.add(graph.getName());
    }
    return result;
}
 
Example #24
Source File: Parser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputBlock start() throws SAXException {
    InputGraph graph = getParentObject();
    String name = readRequiredAttribute(BLOCK_NAME_PROPERTY).intern();
    InputBlock b = new InputBlock(getParentObject(), name);
    graph.addBlock(b);
    return b;
}
 
Example #25
Source File: Source.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean isInBlock(InputGraph g, InputBlock blockNode) {

        for (InputNode n : this.getSourceNodes()) {
            if (g.getBlock(n) == blockNode) {
                return true;
            }
        }
        return false;
    }
 
Example #26
Source File: Parser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputGraph start() throws SAXException {

    String name = readAttribute(GRAPH_NAME_PROPERTY);
    InputGraph previous = getParentObject().getLastAdded();
    if (!difference) {
        previous = null;
    }
    InputGraph curGraph = new InputGraph(getParentObject(), previous, name);
    this.graph = curGraph;
    return curGraph;
}
 
Example #27
Source File: Parser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputBlock start() throws SAXException {
    InputGraph graph = getParentObject();
    String name = readRequiredAttribute(BLOCK_NAME_PROPERTY).intern();
    InputBlock b = new InputBlock(getParentObject(), name);
    graph.addBlock(b);
    return b;
}
 
Example #28
Source File: ServerCompilerScheduler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Collection<InputBlock> schedule(InputGraph graph) {
    if (graph.getBlocks().size() > 0) {
        Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
        for (InputNode n : tmpNodes) {
            String block = getBlockName(n);
            if (graph.getBlock(n) == null) {
                graph.getBlock(block).addNode(n);
                assert graph.getBlock(n) != null;
            }
        }
        return graph.getBlocks();
    } else {
        nodes = new ArrayList<Node>();
        inputNodeToNode = new HashMap<InputNode, Node>();

        this.graph = graph;
        buildUpGraph();
        buildBlocks();
        buildDominators();
        buildCommonDominators();
        scheduleLatest();

        for (InputNode n : graph.getNodes()) {
            assert graph.getBlock(n) != null;
        }

        return blocks;
    }
}
 
Example #29
Source File: ServerCompilerScheduler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Collection<InputBlock> schedule(InputGraph graph) {
    if (graph.getBlocks().size() > 0) {
        Collection<InputNode> tmpNodes = new ArrayList<InputNode>(graph.getNodes());
        for (InputNode n : tmpNodes) {
            String block = getBlockName(n);
            if (graph.getBlock(n) == null) {
                graph.getBlock(block).addNode(n);
                assert graph.getBlock(n) != null;
            }
        }
        return graph.getBlocks();
    } else {
        nodes = new ArrayList<Node>();
        inputNodeToNode = new HashMap<InputNode, Node>();

        this.graph = graph;
        buildUpGraph();
        buildBlocks();
        buildDominators();
        buildCommonDominators();
        scheduleLatest();

        for (InputNode n : graph.getNodes()) {
            assert graph.getBlock(n) != null;
        }

        return blocks;
    }
}
 
Example #30
Source File: Parser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected InputGraph start() throws SAXException {

    String name = readAttribute(GRAPH_NAME_PROPERTY);
    InputGraph previous = getParentObject().getLastAdded();
    if (!difference) {
        previous = null;
    }
    InputGraph curGraph = new InputGraph(getParentObject(), previous, name);
    this.graph = curGraph;
    return curGraph;
}