Mercurial > hg > graal-compiler
changeset 15025:292353f2645c
CFGPrinter: workaround for bytecode dumping.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 07 Apr 2014 15:04:14 +0200 |
parents | 2ee777221036 |
children | d0294fa66a33 |
files | graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java |
diffstat | 2 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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) {
--- 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;