# HG changeset patch # User Josef Eisl # Date 1395238228 -3600 # Node ID f200eb89072992c672959efafac330dfbba8d901 # Parent fafbff0eeebf4433bc8baeb6be3dbeadfebc8fa4 Handle AbstractBlock in CFGPrinter. diff -r fafbff0eeebf -r f200eb890729 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 Wed Mar 19 13:50:52 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Mar 19 15:10:28 2014 +0100 @@ -145,18 +145,15 @@ } } } - printedNodes = new NodeBitMap(cfg.graph); begin("cfg"); out.print("name \"").print(label).println('"'); - for (AbstractBlock abstractBlock : blocks) { - Block block = (Block) abstractBlock; + for (AbstractBlock block : blocks) { printBlock(block, printNodes); } end("cfg"); latestScheduling = null; - printedNodes = null; } private void scheduleInputs(Node node, Block nodeBlock) { @@ -187,7 +184,7 @@ } } - private void printBlock(Block block, boolean printNodes) { + private void printBlock(AbstractBlock block, boolean printNodes) { begin("block"); out.print("name \"").print(blockToString(block)).println('"'); @@ -195,13 +192,13 @@ out.println("to_bci -1"); out.print("predecessors "); - for (Block pred : block.getPredecessors()) { + for (AbstractBlock pred : block.getPredecessors()) { out.print("\"").print(blockToString(pred)).print("\" "); } out.println(); out.print("successors "); - for (Block succ : block.getSuccessors()) { + for (AbstractBlock succ : block.getSuccessors()) { if (!succ.isExceptionEntry()) { out.print("\"").print(blockToString(succ)).print("\" "); } @@ -209,7 +206,7 @@ out.println(); out.print("xhandlers"); - for (Block succ : block.getSuccessors()) { + for (AbstractBlock succ : block.getSuccessors()) { if (succ.isExceptionEntry()) { out.print("\"").print(blockToString(succ)).print("\" "); } @@ -234,7 +231,10 @@ } if (printNodes) { - printNodes(block); + printedNodes = new NodeBitMap(cfg.graph); + assert block instanceof Block; + printNodes((Block) block); + printedNodes = null; } printLIR(block); end("block"); @@ -419,7 +419,7 @@ * * @param block the block to print */ - private void printLIR(Block block) { + private void printLIR(AbstractBlock block) { if (lir == null) { return; } @@ -481,13 +481,13 @@ return prefix + node.toString(Verbosity.Id); } - private String blockToString(Block block) { - if (lir == null) { + private String blockToString(AbstractBlock block) { + if (lir == null && block instanceof Block) { // During all the front-end phases, the block schedule is built only for the debug // output. // Therefore, the block numbers would be different for every CFG printed -> use the id // of the first instruction. - return "B" + block.getBeginNode().toString(Verbosity.Id); + return "B" + ((Block) block).getBeginNode().toString(Verbosity.Id); } else { // LIR instructions contain references to blocks and these blocks are printed as the // blockID -> use the blockID. diff -r fafbff0eeebf -r f200eb890729 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 Wed Mar 19 13:50:52 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Wed Mar 19 15:10:28 2014 +0100 @@ -140,8 +140,7 @@ if (cfgPrinter.lirGenerator != null) { cfgPrinter.target = cfgPrinter.lirGenerator.target(); } - if (cfgPrinter.lir != null) { - assert cfgPrinter.lir.getControlFlowGraph() instanceof ControlFlowGraph; + if (cfgPrinter.lir != null && cfgPrinter.lir.getControlFlowGraph() instanceof ControlFlowGraph) { cfgPrinter.cfg = (ControlFlowGraph) cfgPrinter.lir.getControlFlowGraph(); } @@ -160,7 +159,7 @@ } else if (object instanceof LIR) { // No need to print the HIR nodes again if this is not the first // time dumping the same LIR since the HIR will not have changed. - boolean printNodes = previousObject != object; + boolean printNodes = previousObject != object && cfgPrinter.cfg != null; cfgPrinter.printCFG(message, cfgPrinter.lir.codeEmittingOrder(), printNodes); } else if (object instanceof StructuredGraph) {