# HG changeset patch # User Josef Eisl # Date 1396875854 -7200 # Node ID 292353f2645c43786aa84a5f56f61818a09745d3 # Parent 2ee7772210361915c01f48c2d5ef65ab36f7356d CFGPrinter: workaround for bytecode dumping. diff -r 2ee777221036 -r 292353f2645c graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Tue Apr 08 16:04:00 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Mon Apr 07 15:04:14 2014 +0200 @@ -37,6 +37,7 @@ import com.oracle.graal.graph.NodeClass.NodeClassIterator; import com.oracle.graal.graph.NodeClass.Position; import com.oracle.graal.java.*; +import com.oracle.graal.java.BciBlockMapping.BciBlock; import com.oracle.graal.lir.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; @@ -53,10 +54,11 @@ protected NodeLIRBuilder nodeLirGenerator; protected ControlFlowGraph cfg; protected SchedulePhase schedule; + protected ResolvedJavaMethod method; /** * Creates a control flow graph printer. - * + * * @param out where the output generated via this printer shown be written */ public CFGPrinter(OutputStream out) { @@ -65,7 +67,7 @@ /** * Prints the control flow graph denoted by a given block map. - * + * * @param label A label describing the compilation phase that produced the control flow graph. * @param blockMap A data structure describing the blocks in a method and how they are * connected. @@ -125,7 +127,7 @@ /** * Prints the specified list of blocks. - * + * * @param label A label describing the compilation phase that produced the control flow graph. * @param blocks The list of blocks to be printed. */ @@ -154,6 +156,12 @@ printBlock(block, printNodes); } end("cfg"); + // NOTE: we do this only because the c1visualizer does not recognize the bytecode block if + // it is proceeding the cfg blocks. Currently we have no direct influence on the emit order. + // As a workaround we dump the bytecode after every cfg. + if (method != null) { + printBytecodes(new BytecodeDisassembler(false).disassemble(method)); + } latestScheduling = null; } @@ -204,8 +212,13 @@ begin("block"); out.print("name \"").print(blockToString(block)).println('"'); - out.println("from_bci -1"); - out.println("to_bci -1"); + if (block instanceof BciBlock) { + out.print("from_bci ").println(((BciBlock) block).startBci); + out.print("to_bci ").println(((BciBlock) block).endBci); + } else { + out.println("from_bci -1"); + out.println("to_bci -1"); + } out.print("predecessors "); for (AbstractBlock pred : block.getPredecessors()) { @@ -425,7 +438,7 @@ /** * Prints the LIR for each instruction in a given block. - * + * * @param block the block to print */ private void printLIR(AbstractBlock block) { diff -r 2ee777221036 -r 292353f2645c graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Tue Apr 08 16:04:00 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Mon Apr 07 15:04:14 2014 +0200 @@ -131,6 +131,9 @@ if (!checkMethodScope()) { return; } + if (curMethod instanceof ResolvedJavaMethod) { + cfgPrinter.method = (ResolvedJavaMethod) curMethod; + } if (object instanceof LIR) { cfgPrinter.lir = (LIR) object;