annotate graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java @ 7530:5e3d1a68664e

applied mx eclipseformat to all Java files
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Jan 2013 16:34:57 +0100
parents 2463eb24b644
children 50f02c7d1cec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.printer;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.io.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.util.Map.Entry;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
29 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
31 import com.oracle.graal.graph.Node.Verbosity;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.graph.NodeClass.NodeClassIterator;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 import com.oracle.graal.graph.NodeClass.Position;
5763
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5568
diff changeset
34 import com.oracle.graal.java.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.nodes.*;
6529
2e96dc4eb8e2 renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents: 6525
diff changeset
36 import com.oracle.graal.nodes.cfg.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 5819
diff changeset
37 import com.oracle.graal.phases.schedule.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
40 * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
41 * <a href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 */
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5814
diff changeset
43 class IdealGraphPrinter extends BasicIdealGraphPrinter implements GraphPrinter {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
44
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 public IdealGraphPrinter(OutputStream stream) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
49 super(stream);
5819
8fd81d0e3acf Make DebugDumpHandler closable, close them on compiler thread when compiler threads finish
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5815
diff changeset
50 this.begin();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
54 * Starts a new group of graphs with the given name, short name and method byte code index (BCI)
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
55 * as properties.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 */
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5814
diff changeset
57 @Override
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
58 public void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
59 beginGroup();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
60 beginProperties();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
61 printProperty("name", name);
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
62 endProperties();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
63 beginMethod(name, shortName, bci);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6529
diff changeset
64 if (method != null && method.getCode() != null) {
5763
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5568
diff changeset
65 printBytecodes(new BytecodeDisassembler(false).disassemble(method));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
67 endMethod();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
70 public void print(Graph graph, String title) {
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
71 print(graph, title, null);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
75 * Prints an entire {@link Graph} with the specified title, optionally using short names for
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
76 * nodes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 */
5815
272f9da7ce78 Put Binary and xml dumpers behing a common interface and use the same dumphandler for them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5814
diff changeset
78 @Override
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
79 public void print(Graph graph, String title, SchedulePhase predefinedSchedule) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
80 beginGraph(title);
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
81 Set<Node> noBlockNodes = new HashSet<>();
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
82 SchedulePhase schedule = predefinedSchedule;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 if (schedule == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 try {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
85 schedule = new SchedulePhase();
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
86 schedule.apply((StructuredGraph) graph);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 } catch (Throwable t) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
90 ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
92 beginNodes();
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5568
diff changeset
93 List<Edge> edges = printNodes(graph, cfg == null ? null : cfg.getNodeToBlock(), noBlockNodes);
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
94 endNodes();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
96 beginEdges();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 for (Edge edge : edges) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
98 printEdge(edge);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
100 endEdges();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5568
diff changeset
102 if (cfg != null && cfg.getBlocks() != null) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
103 beginControlFlow();
5810
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5568
diff changeset
104 for (Block block : cfg.getBlocks()) {
bc237d8b6f99 Add binary graph dumping to compiler (-G:+PrintBinaryGraphs)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5568
diff changeset
105 printBlock(graph, block, cfg.getNodeToBlock());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
107 printNoBlock(noBlockNodes);
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
108 endControlFlow();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
111 endGraph();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112 flush();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
113 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
115 private List<Edge> printNodes(Graph graph, NodeMap<Block> nodeToBlock, Set<Node> noBlockNodes) {
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
116 ArrayList<Edge> edges = new ArrayList<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 NodeMap<Set<Entry<String, Integer>>> colors = graph.createNodeMap();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 NodeMap<Set<Entry<String, String>>> colorsToString = graph.createNodeMap();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 NodeMap<Set<String>> bits = graph.createNodeMap();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 for (Node node : graph.getNodes()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
124 beginNode(node.toString(Verbosity.Id));
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
125 beginProperties();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
126 printProperty("idx", node.toString(Verbosity.Id));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128 Map<Object, Object> props = node.getDebugProperties();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 if (!props.containsKey("name") || props.get("name").toString().trim().length() == 0) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
130 String name = node.toString(Verbosity.Name);
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
131 printProperty("name", name);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
133 printProperty("class", node.getClass().getSimpleName());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 Block block = nodeToBlock == null ? null : nodeToBlock.get(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 if (block != null) {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
136 printProperty("block", Integer.toString(block.getId()));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
137 // if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
138 // LocalNode) && !block.nodes().contains(node)) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
139 // printProperty("notInOwnBlock", "true");
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
140 // }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 } else {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
142 printProperty("block", "noBlock");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 noBlockNodes.add(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 Set<Entry<String, Integer>> nodeColors = colors.get(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147 if (nodeColors != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148 for (Entry<String, Integer> color : nodeColors) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 String name = color.getKey();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 Integer value = color.getValue();
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
151 printProperty(name, Integer.toString(value));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 Set<Entry<String, String>> nodeColorStrings = colorsToString.get(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
155 if (nodeColorStrings != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
156 for (Entry<String, String> color : nodeColorStrings) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157 String name = color.getKey();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
158 String value = color.getValue();
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
159 printProperty(name, value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 Set<String> nodeBits = bits.get(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163 if (nodeBits != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
164 for (String bit : nodeBits) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
165 printProperty(bit, "true");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
166 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 }
5814
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
168 if (node.getClass() == BeginNode.class) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
169 printProperty("shortName", "B");
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
170 } else if (node.getClass() == EndNode.class) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
171 printProperty("shortName", "E");
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
172 }
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
173 if (node.predecessor() != null) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
174 printProperty("hasPredecessor", "true");
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
175 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 for (Entry<Object, Object> entry : props.entrySet()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 String key = entry.getKey().toString();
5814
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
179 Object value = entry.getValue();
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
180 String valueString;
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
181 if (value == null) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
182 valueString = "null";
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
183 } else {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
184 Class<?> type = value.getClass();
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
185 if (type.isArray()) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
186 if (!type.getComponentType().isPrimitive()) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
187 valueString = Arrays.toString((Object[]) value);
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
188 } else if (type.getComponentType() == Integer.TYPE) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
189 valueString = Arrays.toString((int[]) value);
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
190 } else if (type.getComponentType() == Double.TYPE) {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
191 valueString = Arrays.toString((double[]) value);
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
192 } else {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
193 valueString = toString();
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
194 }
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
195 } else {
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
196 valueString = value.toString();
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
197 }
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
198 }
d241f8b2e6f9 Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5811
diff changeset
199 printProperty(key, valueString);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
201
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
202 endProperties();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
203 endNode();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
204
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 // successors
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206 int fromIndex = 0;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 NodeClassIterator succIter = node.successors().iterator();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 while (succIter.hasNext()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 Position position = succIter.nextPosition();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 Node successor = node.getNodeClass().get(node, position);
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
211 if (successor != null) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
212 edges.add(new Edge(node.toString(Verbosity.Id), fromIndex, successor.toString(Verbosity.Id), 0, node.getNodeClass().getName(position)));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
213 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
214 fromIndex++;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 // inputs
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
218 int toIndex = 1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
219 NodeClassIterator inputIter = node.inputs().iterator();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
220 while (inputIter.hasNext()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221 Position position = inputIter.nextPosition();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
222 Node input = node.getNodeClass().get(node, position);
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
223 if (input != null) {
4411
cd2b68ef8e23 cleanup around filter and predicates :
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4327
diff changeset
224 edges.add(new Edge(input.toString(Verbosity.Id), input.successors().count(), node.toString(Verbosity.Id), toIndex, node.getNodeClass().getName(position)));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 toIndex++;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
227 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
228 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
230 return edges;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
232
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
233 private void printBlock(Graph graph, Block block, NodeMap<Block> nodeToBlock) {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
234 beginBlock(Integer.toString(block.getId()));
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
235 beginSuccessors();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236 for (Block sux : block.getSuccessors()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237 if (sux != null) {
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
238 printSuccessor(Integer.toString(sux.getId()));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
239 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
241 endSuccessors();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
242 beginBlockNodes();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
243
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
244 Set<Node> nodes = new HashSet<>();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 if (nodeToBlock != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 for (Node n : graph.getNodes()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248 Block blk = nodeToBlock.get(n);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 if (blk == block) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 nodes.add(n);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
251 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 if (nodes.size() > 0) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 // if this is the first block: add all locals to this block
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
257 if (block.getBeginNode() == ((StructuredGraph) graph).start()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
258 for (Node node : graph.getNodes()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 if (node instanceof LocalNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
260 nodes.add(node);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
261 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
262 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
263 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
264
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
265 Set<Node> snapshot = new HashSet<>(nodes);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
266 // add all framestates and phis to their blocks
4435
57cb8ec5f6bb Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4414
diff changeset
267 for (Node node : snapshot) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 if (node instanceof StateSplit && ((StateSplit) node).stateAfter() != null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
269 nodes.add(((StateSplit) node).stateAfter());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
270 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 if (node instanceof MergeNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272 for (PhiNode phi : ((MergeNode) node).phis()) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 nodes.add(phi);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
275 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
276 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
278 for (Node node : nodes) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
279 printBlockNode(node.toString(Verbosity.Id));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
280 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
281 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
282 endBlockNodes();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
283 endBlock();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
284 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
285
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
286 private void printNoBlock(Set<Node> noBlockNodes) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
287 if (!noBlockNodes.isEmpty()) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
288 beginBlock("noBlock");
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
289 beginBlockNodes();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
290 for (Node node : noBlockNodes) {
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
291 printBlockNode(node.toString(Verbosity.Id));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
292 }
4414
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
293 endBlockNodes();
bae1b1f29984 fix merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4413
diff changeset
294 endBlock();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
295 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
296 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297 }