# HG changeset patch # User Lukas Stadler # Date 1305030580 -7200 # Node ID 8e44074058afe430f5ffd30578c9930590276243 # Parent dd115f80acf8cdaa14a46b71260a35c0b95fc303 remove explicit pointer from BlockEnd to BlockBegin diff -r dd115f80acf8 -r 8e44074058af graal/GraalCompiler/src/com/sun/c1x/graph/BlockMap.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/BlockMap.java Tue May 10 11:55:12 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/BlockMap.java Tue May 10 14:29:40 2011 +0200 @@ -265,7 +265,7 @@ return null; } - BlockBegin make(int bci) { + private BlockBegin make(int bci) { BlockBegin block = blockMap[bci]; if (block == null) { block = new BlockBegin(bci, blockNum++, graph); diff -r dd115f80acf8 -r 8e44074058af graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Tue May 10 11:55:12 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Tue May 10 14:29:40 2011 +0200 @@ -82,15 +82,12 @@ BlockEnd old = this.end(); if (old != end) { if (old != null) { - // disconnect this block from the old end - old.setBegin(null); // disconnect this block from its current successors for (BlockBegin s : old.blockSuccessors()) { s.blockPredecessors().remove(this); } } successors().set(super.successorCount() + SUCCESSOR_END, end); - end.setBegin(this); for (BlockBegin s : end.blockSuccessors()) { s.addPredecessor(this); } diff -r dd115f80acf8 -r 8e44074058af graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java Tue May 10 11:55:12 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java Tue May 10 14:29:40 2011 +0200 @@ -79,8 +79,7 @@ return blockSuccessorCount; } - BlockBegin begin; - boolean isSafepoint; + private boolean isSafepoint; /** * Constructs a new block end with the specified value type. @@ -120,17 +119,12 @@ * @return the beginning of this basic block */ public BlockBegin begin() { - return begin; - } - - /** - * Sets the basic block beginning for this block end. This should only - * be called from {@link BlockBegin}. - * - * @param block the beginning of this basic block - */ - void setBegin(BlockBegin block) { - begin = block; + for (Node n : predecessors()) { + if (n instanceof BlockBegin) { + return (BlockBegin) n; + } + } + return null; } /** diff -r dd115f80acf8 -r 8e44074058af graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java Tue May 10 11:55:12 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java Tue May 10 14:29:40 2011 +0200 @@ -181,7 +181,7 @@ while (!(cur instanceof BlockEnd)) { cur = cur.next(); } - return ((BlockEnd) cur).begin; + return ((BlockEnd) cur).begin(); } /** diff -r dd115f80acf8 -r 8e44074058af graal/GraalGraphviz/src/com/oracle/graal/graph/vis/GraphvizPrinter.java --- a/graal/GraalGraphviz/src/com/oracle/graal/graph/vis/GraphvizPrinter.java Tue May 10 11:55:12 2011 +0200 +++ b/graal/GraalGraphviz/src/com/oracle/graal/graph/vis/GraphvizPrinter.java Tue May 10 14:29:40 2011 +0200 @@ -80,7 +80,9 @@ public void print(Graph graph, boolean shortNames) { // graph.getNodes() returns all the graph's nodes, not just "roots" for (Node n : graph.getNodes()) { - printNode(n, shortNames); + if (n != null) { + printNode(n, shortNames); + } } }