# HG changeset patch # User Lukas Stadler # Date 1305031434 -7200 # Node ID 4663477045cba0243794ba6524c84982c37a6840 # Parent 62ff4a70f07ec91afa2aea0da2cbe05e07c61edf# Parent b129b7da139769b33e270e5ef0b08afb76948eca merge diff -r 62ff4a70f07e -r 4663477045cb graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java --- a/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Tue May 10 14:39:54 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Tue May 10 14:43:54 2011 +0200 @@ -78,6 +78,7 @@ public static boolean PrintCodeBytes = ____; public static int PrintAssemblyBytesPerLine = 16; public static int TraceLinearScanLevel = 0; + public static int TraceLIRGeneratorLevel = 0; public static boolean TraceRelocation = ____; public static boolean TraceLIRVisit = ____; public static boolean TraceAssembler = ____; diff -r 62ff4a70f07e -r 4663477045cb graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java --- a/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java Tue May 10 14:39:54 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java Tue May 10 14:43:54 2011 +0200 @@ -202,14 +202,14 @@ * @param block the block for which the frame state is to be printed */ private void printState(BlockBegin block) { - begin("state"); + begin("states"); FrameState state = block.stateBefore(); int stackSize = state.stackSize(); if (stackSize > 0) { begin("stack"); out.print("size ").println(stackSize); - out.print("bci ").println(state.bci); + out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"'); int i = 0; while (i < stackSize) { @@ -231,7 +231,7 @@ if (state.locksSize() > 0) { begin("locks"); out.print("size ").println(state.locksSize()); - out.print("bci ").println(state.bci); + out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"'); for (int i = 0; i < state.locksSize(); ++i) { Value value = state.lockAt(i); @@ -246,7 +246,7 @@ begin("locals"); out.print("size ").println(state.localsSize()); - out.print("bci ").println(state.bci); + out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"'); int i = 0; while (i < state.localsSize()) { Value value = state.localAt(i); @@ -263,7 +263,7 @@ } } end("locals"); - end("state"); + end("states"); } /** @@ -275,7 +275,7 @@ } StringBuilder buf = new StringBuilder(); - buf.append("[bci: ").append(state.bci).append("]"); + buf.append(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)); buf.append('\n'); if (state.stackSize() > 0) { int i = 0; diff -r 62ff4a70f07e -r 4663477045cb graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Tue May 10 14:39:54 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Tue May 10 14:43:54 2011 +0200 @@ -225,15 +225,29 @@ blockDoProlog(block); this.currentBlock = block; + if (C1XOptions.TraceLIRGeneratorLevel >= 1) { + TTY.println("BEGIN Generating LIR for block B" + block.blockID); + } + for (Instruction instr = block; instr != null; instr = instr.next()) { FrameState stateAfter = instr.stateAfter(); - if (stateAfter != null) { - lastState = stateAfter; - } if (!(instr instanceof BlockBegin)) { walkState(instr, stateAfter); doRoot(instr); } + if (stateAfter != null) { + lastState = stateAfter; + if (C1XOptions.TraceLIRGeneratorLevel >= 2) { + TTY.println("STATE CHANGE"); + if (C1XOptions.TraceLIRGeneratorLevel >= 3) { + TTY.println(stateAfter.toString()); + } + } + } + } + + if (C1XOptions.TraceLIRGeneratorLevel >= 1) { + TTY.println("END Generating LIR for block B" + block.blockID); } this.currentBlock = null; @@ -256,7 +270,7 @@ public void visitBase(Base x) { // emit phi-instruction move after safepoint since this simplifies // describing the state at the safepoint. - moveToPhi(); + //moveToPhi(); // all blocks with a successor must end with an unconditional jump // to the successor even if they are consecutive @@ -1234,6 +1248,9 @@ } void doRoot(Instruction instr) { + if (C1XOptions.TraceLIRGeneratorLevel >= 2) { + TTY.println("Emitting LIR for instruction " + instr.toString()); + } currentInstruction = instr; assert !instr.hasSubst() : "shouldn't have missed substitution"; diff -r 62ff4a70f07e -r 4663477045cb graal/GraalCompiler/src/com/sun/c1x/ir/Value.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java Tue May 10 14:39:54 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java Tue May 10 14:43:54 2011 +0200 @@ -275,9 +275,13 @@ @Override public String toString() { StringBuilder builder = new StringBuilder(); + builder.append("#"); + builder.append(id()); + builder.append(' '); + if (id() < 10) { + builder.append(' '); + } builder.append(getClass().getSimpleName()); - builder.append(" #"); - builder.append(id()); if (this instanceof Instruction) { builder.append(" @ "); builder.append(((Instruction) this).bci());