Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java @ 2787:9253df721472
Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
author | Peter Hofer <peter.hofer@jku.at> |
---|---|
date | Wed, 25 May 2011 17:48:56 +0200 |
parents | 39a9d62e4c60 |
children | d3fc4fe063bf |
comparison
equal
deleted
inserted
replaced
2786:39a9d62e4c60 | 2787:9253df721472 |
---|---|
22 */ | 22 */ |
23 package com.sun.c1x.debug; | 23 package com.sun.c1x.debug; |
24 | 24 |
25 import java.io.*; | 25 import java.io.*; |
26 import java.util.*; | 26 import java.util.*; |
27 import java.util.Map.Entry; | |
27 | 28 |
28 import com.oracle.graal.graph.*; | 29 import com.oracle.graal.graph.*; |
29 | 30 |
30 /** | 31 /** |
31 * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the <a | 32 * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the <a |
127 for (Node node : nodes) { | 128 for (Node node : nodes) { |
128 if (node == Node.Null || omittedClasses.contains(node)) { | 129 if (node == Node.Null || omittedClasses.contains(node)) { |
129 continue; | 130 continue; |
130 } | 131 } |
131 | 132 |
132 String name; | 133 stream.printf(" <node id='%d'><properties>%n", node.id()); |
133 if (shortNames) { | 134 stream.printf(" <p name='idx'>%d</p>%n", node.id()); |
134 name = node.shortName(); | 135 |
135 } else { | 136 Map<Object, Object> props = node.getDebugProperties(); |
136 name = node.toString(); | 137 if (!props.containsKey("name")) { |
138 String name; | |
139 if (shortNames) { | |
140 name = node.shortName(); | |
141 } else { | |
142 name = node.toString(); | |
143 } | |
144 stream.printf(" <p name='name'>%s</p>%n", escape(name)); | |
145 } | |
146 for (Entry<Object, Object> entry : props.entrySet()) { | |
147 String key = entry.getKey().toString(); | |
148 String value = entry.getValue().toString(); | |
149 stream.printf(" <p name='%s'>%s</p>%n", escape(key), escape(value)); | |
137 } | 150 } |
138 | 151 |
139 stream.printf(" <node id='%d'><properties>", node.id()); | 152 stream.println(" </properties></node>"); |
140 stream.printf("<p name='idx'>%d</p>", node.id()); | |
141 stream.printf("<p name='name'>%s</p>", escape(name)); | |
142 stream.println("</properties></node>"); | |
143 | 153 |
144 // successors | 154 // successors |
145 int fromIndex = 0; | 155 int fromIndex = 0; |
146 for (Node successor : node.successors()) { | 156 for (Node successor : node.successors()) { |
147 if (successor != Node.Null && !omittedClasses.contains(successor.getClass())) { | 157 if (successor != Node.Null && !omittedClasses.contains(successor.getClass())) { |