comparison graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java @ 2623:b129b7da1397

Some fixes around LIRGenerator / frame state. New option C1X:TraceLIRGeneratorLevel
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Tue, 10 May 2011 14:34:03 +0200
parents 91d3952f7eb7
children b2c1e959be46
comparison
equal deleted inserted replaced
2622:91d3952f7eb7 2623:b129b7da1397
200 * Prints the JVM frame state upon entry to a given block. 200 * Prints the JVM frame state upon entry to a given block.
201 * 201 *
202 * @param block the block for which the frame state is to be printed 202 * @param block the block for which the frame state is to be printed
203 */ 203 */
204 private void printState(BlockBegin block) { 204 private void printState(BlockBegin block) {
205 begin("state"); 205 begin("states");
206 206
207 FrameState state = block.stateBefore(); 207 FrameState state = block.stateBefore();
208 int stackSize = state.stackSize(); 208 int stackSize = state.stackSize();
209 if (stackSize > 0) { 209 if (stackSize > 0) {
210 begin("stack"); 210 begin("stack");
211 out.print("size ").println(stackSize); 211 out.print("size ").println(stackSize);
212 out.print("bci ").println(state.bci); 212 out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"');
213 213
214 int i = 0; 214 int i = 0;
215 while (i < stackSize) { 215 while (i < stackSize) {
216 Value value = state.stackAt(i); 216 Value value = state.stackAt(i);
217 out.disableIndentation(); 217 out.disableIndentation();
229 } 229 }
230 230
231 if (state.locksSize() > 0) { 231 if (state.locksSize() > 0) {
232 begin("locks"); 232 begin("locks");
233 out.print("size ").println(state.locksSize()); 233 out.print("size ").println(state.locksSize());
234 out.print("bci ").println(state.bci); 234 out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"');
235 235
236 for (int i = 0; i < state.locksSize(); ++i) { 236 for (int i = 0; i < state.locksSize(); ++i) {
237 Value value = state.lockAt(i); 237 Value value = state.lockAt(i);
238 out.disableIndentation(); 238 out.disableIndentation();
239 out.print(block.stateString(i, value)); 239 out.print(block.stateString(i, value));
244 end("locks"); 244 end("locks");
245 } 245 }
246 246
247 begin("locals"); 247 begin("locals");
248 out.print("size ").println(state.localsSize()); 248 out.print("size ").println(state.localsSize());
249 out.print("bci ").println(state.bci); 249 out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"');
250 int i = 0; 250 int i = 0;
251 while (i < state.localsSize()) { 251 while (i < state.localsSize()) {
252 Value value = state.localAt(i); 252 Value value = state.localAt(i);
253 if (value != null) { 253 if (value != null) {
254 out.disableIndentation(); 254 out.disableIndentation();
261 } else { 261 } else {
262 i++; 262 i++;
263 } 263 }
264 } 264 }
265 end("locals"); 265 end("locals");
266 end("state"); 266 end("states");
267 } 267 }
268 268
269 /** 269 /**
270 * Formats a given {@linkplain FrameState JVM frame state} as a multi line string. 270 * Formats a given {@linkplain FrameState JVM frame state} as a multi line string.
271 */ 271 */
273 if (state == null) { 273 if (state == null) {
274 return null; 274 return null;
275 } 275 }
276 276
277 StringBuilder buf = new StringBuilder(); 277 StringBuilder buf = new StringBuilder();
278 buf.append("[bci: ").append(state.bci).append("]"); 278 buf.append(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci));
279 buf.append('\n'); 279 buf.append('\n');
280 if (state.stackSize() > 0) { 280 if (state.stackSize() > 0) {
281 int i = 0; 281 int i = 0;
282 buf.append("stack: "); 282 buf.append("stack: ");
283 while (i < state.stackSize()) { 283 while (i < state.stackSize()) {