changeset 2793:d3fc4fe063bf

Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Fri, 27 May 2011 11:08:55 +0200
parents 2f3258e3800e
children bec08f6d56ad
files graal/GraalCompiler/src/com/oracle/max/graal/schedule/Block.java graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java graal/GraalCompiler/src/com/sun/c1x/debug/BlockPrinter.java graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinterObserver.java graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java graal/GraalCompiler/src/com/sun/c1x/ir/BlockClosure.java graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java graal/GraalCompiler/src/com/sun/c1x/ir/BlockList.java graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java graal/GraalCompiler/src/com/sun/c1x/ir/If.java graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java graal/GraalCompiler/src/com/sun/c1x/ir/Local.java graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java graal/GraalCompiler/src/com/sun/c1x/ir/Value.java graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java graal/GraalCompiler/src/com/sun/c1x/util/BlockWorkList.java graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java graal/GraalGraph/src/com/oracle/graal/graph/EndNode.java graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java graal/GraalGraph/src/com/oracle/graal/graph/StartNode.java
diffstat 26 files changed, 126 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Block.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Block.java	Fri May 27 11:08:55 2011 +0200
@@ -68,6 +68,31 @@
         return exceptionEntry;
     }
 
+    /**
+     * Iterate over this block, its exception handlers, and its successors, in that order.
+     *
+     * @param closure the closure to apply to each block
+     */
+    public void iteratePreOrder(BlockClosure closure) {
+        // XXX: identity hash map might be too slow, consider a boolean array or a mark field
+        iterate(new IdentityHashMap<Block, Block>(), closure);
+    }
+
+    private void iterate(IdentityHashMap<Block, Block> mark, BlockClosure closure) {
+        if (!mark.containsKey(this)) {
+            mark.put(this, this);
+            closure.apply(this);
+
+            iterateReverse(mark, closure, this.successors);
+        }
+    }
+
+    private void iterateReverse(IdentityHashMap<Block, Block> mark, BlockClosure closure, List<Block> list) {
+        for (int i = list.size() - 1; i >= 0; i--) {
+            list.get(i).iterate(mark, closure);
+        }
+    }
+
     @Override
     public String toString() {
         return "B" + blockID;
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Fri May 27 11:08:55 2011 +0200
@@ -27,7 +27,6 @@
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.ir.*;
-import com.sun.c1x.lir.*;
 
 
 public class Schedule {
@@ -40,7 +39,6 @@
         nodeToBlock = graph.createNodeMap();
         identifyBlocks();
     }
-
     public List<Block> getBlocks() {
         return Collections.unmodifiableList(blocks);
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/BlockPrinter.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/BlockPrinter.java	Fri May 27 11:08:55 2011 +0200
@@ -22,13 +22,14 @@
  */
 package com.sun.c1x.debug;
 
+import com.oracle.max.graal.schedule.*;
 import com.sun.c1x.graph.*;
 import com.sun.c1x.ir.*;
 import com.sun.c1x.util.*;
 import com.sun.c1x.value.*;
 
 /**
- * Prints a listing for a {@linkplain BlockBegin block}.
+ * Prints a listing for a {@linkplain Merge block}.
  */
 public class BlockPrinter implements BlockClosure {
 
@@ -40,25 +41,26 @@
         this.cfgOnly = cfgOnly;
     }
 
-    public void apply(BlockBegin block) {
+    public void apply(Block block) {
         if (cfgOnly) {
-            ip.printInstruction(block);
+            if (block.getInstructions().size() > 0) {
+                ip.printInstruction(block.getInstructions().get(0));
+            } else {
+                ip.out().println("Empty block");
+            }
             ip.out().println();
         } else {
             printBlock(block);
         }
     }
 
-    public void printBlock(BlockBegin block) {
-        ip.printInstruction(block);
+    public void printBlock(Block block) {
         LogStream out = ip.out();
         out.println();
-        printFrameState(block.stateBefore(), out);
-        out.println();
 
         ip.printInstructionListingHeader();
 
-        for (Instruction i = block.next(); i != null; i = i.next()) {
+        for (Instruction i : block.getInstructions()) {
             ip.printInstructionListing(i);
         }
         out.println();
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java	Fri May 27 11:08:55 2011 +0200
@@ -25,6 +25,7 @@
 import java.io.*;
 import java.util.*;
 
+import com.oracle.max.graal.schedule.*;
 import com.sun.c1x.*;
 import com.sun.c1x.alloc.*;
 import com.sun.c1x.alloc.Interval.*;
@@ -122,28 +123,28 @@
      * @param printHIR if {@code true} the HIR for each instruction in the block will be printed
      * @param printLIR if {@code true} the LIR for each instruction in the block will be printed
      */
-    void printBlock(BlockBegin block, List<BlockBegin> successors, BlockBegin handler, boolean printHIR, boolean printLIR) {
+    void printBlock(Block block, List<Block> successors, Block handler, boolean printHIR, boolean printLIR) {
         begin("block");
 
-        out.print("name \"B").print(block.blockID).println('"');
+        out.print("name \"B").print(block.blockID()).println('"');
         out.print("from_bci -1");
         out.print("to_bci -1");
 
         out.print("predecessors ");
-        for (Instruction pred : block.blockPredecessors()) {
-            out.print("\"B").print(pred.block().blockID).print("\" ");
+        for (Block pred : block.getPredecessors()) {
+            out.print("\"B").print(pred.blockID()).print("\" ");
         }
         out.println();
 
         out.print("successors ");
-        for (BlockBegin succ : successors) {
-            out.print("\"B").print(succ.blockID).print("\" ");
+        for (Block succ : successors) {
+            out.print("\"B").print(succ.blockID()).print("\" ");
         }
         out.println();
 
         out.print("xhandlers");
         if (handler != null) {
-            out.print("\"B").print(handler.blockID).print("\" ");
+            out.print("\"B").print(handler.blockID()).print("\" ");
         }
         out.println();
 
@@ -154,7 +155,6 @@
         out.print("loop_depth ").println(-1);
 
         if (printHIR) {
-            printState(block);
             printHIR(block);
         }
 
@@ -171,7 +171,7 @@
      *
      * @param block the block for which the frame state is to be printed
      */
-    private void printState(BlockBegin block) {
+    /*private void printState(Block block) {
         begin("states");
 
         FrameState state = block.stateBefore();
@@ -237,7 +237,7 @@
         }
         end("locals");
         end("states");
-    }
+    }*/
 
     /**
      * Formats a given {@linkplain FrameState JVM frame state} as a multi line string.
@@ -403,11 +403,11 @@
      *
      * @param block
      */
-    private void printHIR(BlockBegin block) {
+    private void printHIR(Block block) {
         begin("IR");
         out.println("HIR");
         out.disableIndentation();
-        for (Instruction i = block.next(); i != null; i = i.next()) {
+        for (Instruction i : block.getInstructions()) {
             printInstructionHIR(i);
         }
         out.enableIndentation();
@@ -557,12 +557,12 @@
      * @param printHIR if {@code true} the HIR for each instruction in the block will be printed
      * @param printLIR if {@code true} the LIR for each instruction in the block will be printed
      */
-    public void printCFG(BlockBegin startBlock, String label, final boolean printHIR, final boolean printLIR) {
+    public void printCFG(Block startBlock, String label, final boolean printHIR, final boolean printLIR) {
         begin("cfg");
         out.print("name \"").print(label).println('"');
         startBlock.iteratePreOrder(new BlockClosure() {
-            public void apply(BlockBegin block) {
-                List<BlockBegin> successors = block.end() != null ? block.end().blockSuccessors() : new ArrayList<BlockBegin>(0);
+            public void apply(Block block) {
+                List<Block> successors = block.getSuccessors();
                 printBlock(block, successors, null, printHIR, printLIR);
             }
         });
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinterObserver.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinterObserver.java	Fri May 27 11:08:55 2011 +0200
@@ -25,7 +25,6 @@
 import java.io.*;
 
 import com.sun.c1x.*;
-import com.sun.c1x.ir.*;
 import com.sun.c1x.observer.*;
 import com.sun.cri.ri.*;
 
@@ -74,10 +73,11 @@
             cfgprinted = true;
         }
 
-        if (event.getStartBlock() != null) {
+        // TODO fix that when schedule is here (startBlock : Instruction->Block)
+        /*if (event.getStartBlock() != null) {
             cfgPrinter.printCFG((BlockBegin) event.getStartBlock(), label, event.isHIRValid(), event.isLIRValid());
             cfgprinted = true;
-        }
+        }*/
 
         if (event.getTargetMethod() != null) {
             if (cfgprinted) {
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java	Fri May 27 11:08:55 2011 +0200
@@ -134,7 +134,7 @@
             stream.printf("    <p name='idx'>%d</p>%n", node.id());
 
             Map<Object, Object> props = node.getDebugProperties();
-            if (!props.containsKey("name")) {
+            if (!props.containsKey("name") || props.get("name").toString().trim().length() == 0) {
                 String name;
                 if (shortNames) {
                     name = node.shortName();
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Fri May 27 11:08:55 2011 +0200
@@ -239,7 +239,7 @@
                     }
                 }
             }
-            if (!(instr instanceof BlockBegin)) {
+            if (!(instr instanceof Merge)) {
                 walkState(instr, stateAfter);
                 doRoot(instr);
             }
@@ -853,7 +853,7 @@
             if (rangeDensity >= C1XOptions.RangeTestsSwitchDensity) {
                 visitSwitchRanges(switchRanges, tag, getLIRBlock(x.defaultSuccessor()));
             } else {
-                List<BlockBegin> nonDefaultSuccessors = x.blockSuccessors().subList(0, x.numberOfCases());
+                List<Instruction> nonDefaultSuccessors = x.blockSuccessors().subList(0, x.numberOfCases());
                 LIRBlock[] targets = new LIRBlock[nonDefaultSuccessors.size()];
                 for (int i = 0; i < nonDefaultSuccessors.size(); ++i) {
                     targets[i] = getLIRBlock(nonDefaultSuccessors.get(i));
@@ -1290,7 +1290,7 @@
     private List<Phi> getPhis(LIRBlock block) {
         if (block.getInstructions().size() > 0) {
             Instruction i = block.getInstructions().get(0);
-            if (i instanceof BlockBegin) {
+            if (i instanceof Merge) {
                 List<Phi> result = new ArrayList<Phi>();
                 for (Node n : i.usages()) {
                     if (n instanceof Phi) {
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Fri May 27 11:08:55 2011 +0200
@@ -114,7 +114,7 @@
 
     private final Graph graph;
 
-    private BlockBegin unwindBlock;
+    private Merge unwindBlock;
 
     /**
      * Creates a new, initialized, {@code GraphBuilder} instance for a given compilation.
@@ -294,16 +294,16 @@
         FrameState existingState = ((StateSplit) first).stateBefore();
 
         if (existingState == null) {
-            assert first instanceof BlockBegin ^ !target.isLoopHeader : "isLoopHeader: " + target.isLoopHeader;
+            assert first instanceof Merge ^ !target.isLoopHeader : "isLoopHeader: " + target.isLoopHeader;
 
             // copy state because it is modified
             FrameState duplicate = newState.duplicate(bci);
 
             // if the block is a loop header, insert all necessary phis
             if (target.isLoopHeader) {
-                assert first instanceof BlockBegin;
-                insertLoopPhis((BlockBegin) first, duplicate);
-                ((BlockBegin) first).setStateBefore(duplicate);
+                assert first instanceof Merge;
+                insertLoopPhis((Merge) first, duplicate);
+                ((Merge) first).setStateBefore(duplicate);
             } else {
                 ((StateSplit) first).setStateBefore(duplicate);
             }
@@ -318,7 +318,7 @@
             assert existingState.stackSize() == newState.stackSize();
 
             if (first instanceof Placeholder) {
-                BlockBegin merge = new BlockBegin(existingState.bci, target.blockID, target.isLoopHeader, graph);
+                Merge merge = new Merge(existingState.bci, target.isLoopHeader, graph);
 
                 Placeholder p = (Placeholder) first;
                 assert p.next() == null;
@@ -327,7 +327,7 @@
                 merge.setStateBefore(existingState);
             }
 
-            existingState.merge((BlockBegin) target.firstInstruction, newState);
+            existingState.merge((Merge) target.firstInstruction, newState);
         }
 
         for (int j = 0; j < frameState.localsSize() + frameState.stackSize(); ++j) {
@@ -337,7 +337,7 @@
         }
     }
 
-    private void insertLoopPhis(BlockBegin merge, FrameState newState) {
+    private void insertLoopPhis(Merge merge, FrameState newState) {
         int stackSize = newState.stackSize();
         for (int i = 0; i < stackSize; i++) {
             // always insert phis for the stack
@@ -1066,7 +1066,7 @@
 
         if (block.firstInstruction == null) {
             if (block.isLoopHeader) {
-                block.firstInstruction = new BlockBegin(block.startBci, block.blockID, block.isLoopHeader, graph);
+                block.firstInstruction = new Merge(block.startBci, block.isLoopHeader, graph);
             } else {
                 block.firstInstruction = new Placeholder(graph);
             }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockClosure.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockClosure.java	Fri May 27 11:08:55 2011 +0200
@@ -22,9 +22,11 @@
  */
 package com.sun.c1x.ir;
 
+import com.oracle.max.graal.schedule.*;
+
 /**
  * The {@code BlockClosure} interface represents a closure for iterating over blocks.
  */
 public interface BlockClosure {
-    void apply(BlockBegin block);
+    void apply(Block block);
 }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java	Fri May 27 11:08:55 2011 +0200
@@ -59,7 +59,7 @@
     public Instruction setBlockSuccessor(int index, Instruction n) {
         assert index >= 0 && index < blockSuccessorCount;
 //        assert n == null || n instanceof BlockBegin : "only BlockBegins, for now... " + n.getClass();
-        return (BlockBegin) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n);
+        return (Merge) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n);
     }
 
     public int blockSuccessorCount() {
@@ -91,10 +91,10 @@
      * Gets the block begin associated with this block end.
      * @return the beginning of this basic block
      */
-    public BlockBegin begin() {
+    public Merge begin() {
         for (Node n : predecessors()) {
-            if (n instanceof BlockBegin) {
-                return (BlockBegin) n;
+            if (n instanceof Merge) {
+                return (Merge) n;
             }
         }
         return null;
@@ -106,7 +106,7 @@
      * @param oldSucc the old successor to replace
      * @param newSucc the new successor
      */
-    public int substituteSuccessor(BlockBegin oldSucc, BlockBegin newSucc) {
+    public int substituteSuccessor(Merge oldSucc, Merge newSucc) {
         assert newSucc != null;
         int count = 0;
         for (int i = 0; i < blockSuccessorCount; i++) {
@@ -132,7 +132,7 @@
      * @param b the block to search for in the successor list
      * @return the index of the block in the list if found; <code>-1</code> otherwise
      */
-    public int successorIndex(BlockBegin b) {
+    public int successorIndex(Merge b) {
         for (int i = 0; i < blockSuccessorCount; i++) {
             if (blockSuccessor(i) == b) {
                 return i;
@@ -146,8 +146,8 @@
      * @return the successor list
      */
     @SuppressWarnings({ "unchecked", "rawtypes"})
-    public List<BlockBegin> blockSuccessors() {
-        List<BlockBegin> list = (List) successors().subList(super.successorCount() + SUCCESSOR_COUNT, super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT);
+    public List<Instruction> blockSuccessors() {
+        List<Instruction> list = (List) successors().subList(super.successorCount() + SUCCESSOR_COUNT, super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT);
         return Collections.unmodifiableList(list);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockList.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockList.java	Fri May 27 11:08:55 2011 +0200
@@ -28,16 +28,16 @@
  * The {@code BlockList} class implements a specialized list data structure for representing
  * the predecessor and successor lists of basic blocks.
  */
-public class BlockList implements Iterable<BlockBegin> {
+public class BlockList implements Iterable<Merge> {
 
-    private BlockBegin[] array;
+    private Merge[] array;
     private int cursor;
 
     BlockList(int sizeHint) {
         if (sizeHint > 0) {
-            array = new BlockBegin[sizeHint];
+            array = new Merge[sizeHint];
         } else {
-            array = new BlockBegin[2];
+            array = new Merge[2];
         }
     }
 
@@ -51,7 +51,7 @@
         cursor--;
     }
 
-    public void remove(BlockBegin block) {
+    public void remove(Merge block) {
         int j = 0;
         for (int i = 0; i < cursor; i++) {
             if (i != j) {
@@ -71,12 +71,12 @@
         if (index2 < 0 || index2 >= cursor) {
             throw new IndexOutOfBoundsException();
         }
-        BlockBegin t = array[index2];
+        Merge t = array[index2];
         array[index2] = array[index1];
         array[index1] = t;
     }
 
-    public void insert(int index, BlockBegin block) {
+    public void insert(int index, Merge block) {
         if (index < 0 || index >= cursor) {
             throw new IndexOutOfBoundsException();
         }
@@ -87,19 +87,19 @@
         array[cursor++] = block;
     }
 
-    public void append(BlockBegin block) {
+    public void append(Merge block) {
         growOne();
         array[cursor++] = block;
     }
 
-    public BlockBegin get(int index) {
+    public Merge get(int index) {
         if (index < 0 || index >= cursor) {
             throw new IndexOutOfBoundsException();
         }
         return array[index];
     }
 
-    public void replace(BlockBegin oldBlock, BlockBegin newBlock) {
+    public void replace(Merge oldBlock, Merge newBlock) {
         for (int i = 0; i < cursor; i++) {
             if (array[i] == oldBlock) {
                 array[i] = newBlock;
@@ -111,7 +111,7 @@
         if (cursor == 0) {
             return true;
         }
-        BlockBegin b = array[0];
+        Merge b = array[0];
         for (int i = 1; i < cursor; i++) {
             if (array[i] != b) {
                 return false;
@@ -120,7 +120,7 @@
         return true;
     }
 
-    public Iterator<BlockBegin> iterator() {
+    public Iterator<Merge> iterator() {
         return new Iter();
     }
 
@@ -130,14 +130,14 @@
         }
     }
 
-    private class Iter implements Iterator<BlockBegin> {
+    private class Iter implements Iterator<Merge> {
         private int pos;
 
         public boolean hasNext() {
             return pos < cursor;
         }
 
-        public BlockBegin next() {
+        public Merge next() {
             return array[pos++];
         }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java	Fri May 27 11:08:55 2011 +0200
@@ -114,10 +114,10 @@
         print("instanceof").
         print(' ').
         print(catchType().name()).
-        print(" then B").
-        print(blockSuccessors().get(1).blockID).
+        print(" then ").
+        print(blockSuccessors().get(1).toString()).
         print(" else B").
-        print(blockSuccessors().get(0).blockID);
+        print(blockSuccessors().get(0).toString());
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/If.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/If.java	Fri May 27 11:08:55 2011 +0200
@@ -176,10 +176,10 @@
         print(condition().operator).
         print(' ').
         print(y()).
-        print(" then B").
-        print(blockSuccessors().get(0).blockID).
-        print(" else B").
-        print(blockSuccessors().get(1).blockID);
+        print(" then ").
+        print(blockSuccessors().get(0)).
+        print(" else ").
+        print(blockSuccessors().get(1));
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java	Fri May 27 11:08:55 2011 +0200
@@ -142,13 +142,13 @@
     }
 
     @Override
-    public BlockBegin block() {
+    public Merge block() {
         Instruction cur = this;
-        while (!(cur instanceof BlockBegin)) {
+        while (!(cur instanceof Merge)) {
             List<Node> preds = cur.predecessors();
             cur = (Instruction) preds.get(0);
         }
-        return (BlockBegin) cur;
+        return (Merge) cur;
     }
 
     /**
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Local.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Local.java	Fri May 27 11:08:55 2011 +0200
@@ -47,7 +47,7 @@
     }
 
     @Override
-    public BlockBegin block() {
+    public Merge block() {
         return null;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java	Fri May 27 11:08:55 2011 +0200
@@ -78,7 +78,7 @@
         int l = numberOfCases();
         for (int i = 0; i < l; i++) {
             INSTRUCTION.advance(out);
-            out.printf("case %5d: B%d%n", keyAt(i), blockSuccessors().get(i).blockID);
+            out.printf("case %5d: B%d%n", keyAt(i), blockSuccessors().get(i));
         }
         INSTRUCTION.advance(out);
         out.print("default   : ").print(defaultSuccessor());
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java	Fri May 27 11:08:55 2011 +0200
@@ -50,12 +50,12 @@
      * The join block for this phi.
      */
      @Override
-    public BlockBegin block() {
-        return (BlockBegin) inputs().get(super.inputCount() + INPUT_BLOCK);
+    public Merge block() {
+        return (Merge) inputs().get(super.inputCount() + INPUT_BLOCK);
     }
 
     public Value setBlock(Value n) {
-        return (BlockBegin) inputs().set(super.inputCount() + INPUT_BLOCK, n);
+        return (Merge) inputs().set(super.inputCount() + INPUT_BLOCK, n);
     }
 
     /**
@@ -65,11 +65,11 @@
      * @param index the index into the stack (if < 0) or local variables
      * @param graph
      */
-    public Phi(CiKind kind, BlockBegin block, Graph graph) {
+    public Phi(CiKind kind, Merge block, Graph graph) {
         this(kind, block, DEFAULT_MAX_VALUES, graph);
     }
 
-    public Phi(CiKind kind, BlockBegin block, int maxValues, Graph graph) {
+    public Phi(CiKind kind, Merge block, int maxValues, Graph graph) {
         super(kind, INPUT_COUNT + maxValues, SUCCESSOR_COUNT, graph);
         usedInputCount = 1;
         setBlock(block);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java	Fri May 27 11:08:55 2011 +0200
@@ -80,7 +80,7 @@
         int l = numberOfCases();
         for (int i = 0; i < l; i++) {
             INSTRUCTION.advance(out);
-            out.printf("case %5d: B%d%n", lowKey() + i, blockSuccessors().get(i).blockID);
+            out.printf("case %5d: B%d%n", lowKey() + i, blockSuccessors().get(i));
         }
         INSTRUCTION.advance(out);
         out.print("default   : ").print(defaultSuccessor());
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java	Fri May 27 11:08:55 2011 +0200
@@ -61,7 +61,7 @@
      */
     public Value subst;
 
-    public abstract BlockBegin block();
+    public abstract Merge block();
 
     /**
      * Creates a new value with the specified kind.
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java	Fri May 27 11:08:55 2011 +0200
@@ -33,7 +33,7 @@
     // Checkstyle: stop
     public abstract void visitArithmeticOp(ArithmeticOp i);
     public abstract void visitArrayLength(ArrayLength i);
-    public abstract void visitBlockBegin(BlockBegin i);
+    public abstract void visitMerge(Merge i);
     public abstract void visitCheckCast(CheckCast i);
     public abstract void visitCompareOp(CompareOp i);
     public abstract void visitConstant(Constant i);
--- a/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java	Fri May 27 11:08:55 2011 +0200
@@ -466,7 +466,7 @@
     }
 
     @Override
-    public void visitBlockBegin(BlockBegin x) {
+    public void visitMerge(Merge x) {
         // nothing to do for now
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/util/BlockWorkList.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/util/BlockWorkList.java	Fri May 27 11:08:55 2011 +0200
@@ -38,7 +38,7 @@
  * @author Ben L. Titzer
  */
 public class BlockWorkList {
-    BlockBegin[] workList;
+    Merge[] workList;
     int[] workListNumbers;
     int workListIndex;
 
@@ -46,7 +46,7 @@
      * Adds a block to this list in an unsorted fashion, like a stack.
      * @param block the block to add
      */
-    public void add(BlockBegin block) {
+    public void add(Merge block) {
         if (workList == null) {
             // worklist not allocated yet
             allocate();
@@ -64,7 +64,7 @@
      * @param block the block to add
      * @param number the number used to sort the block
      */
-    public void addSorted(BlockBegin block, int number) {
+    public void addSorted(Merge block, int number) {
         if (workList == null) {
             // worklist not allocated yet
             allocate();
@@ -96,7 +96,7 @@
      * the last block added is returned.
      * @return the next block in the list
      */
-    public BlockBegin removeFromWorkList() {
+    public Merge removeFromWorkList() {
         if (workListIndex != 0) {
             return workList[--workListIndex];
         }
@@ -112,13 +112,13 @@
     }
 
     private void allocate() {
-        workList = new BlockBegin[5];
+        workList = new Merge[5];
         workListNumbers = new int[5];
     }
 
     private void grow() {
         int prevLength = workList.length;
-        BlockBegin[] nworkList = new BlockBegin[prevLength * 3];
+        Merge[] nworkList = new Merge[prevLength * 3];
         System.arraycopy(workList, 0, nworkList, 0, prevLength);
         workList = nworkList;
 
--- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Fri May 27 11:08:55 2011 +0200
@@ -258,7 +258,7 @@
      * @param block the block begin for which we are creating the phi
      * @param i the index into the stack for which to create a phi
      */
-    public Phi setupPhiForStack(BlockBegin block, int i) {
+    public Phi setupPhiForStack(Merge block, int i) {
         Value p = stackAt(i);
         if (p != null) {
             if (p instanceof Phi) {
@@ -279,7 +279,7 @@
      * @param block the block begin for which we are creating the phi
      * @param i the index of the local variable for which to create the phi
      */
-    public Phi setupPhiForLocal(BlockBegin block, int i) {
+    public Phi setupPhiForLocal(Merge block, int i) {
         Value p = localAt(i);
         if (p instanceof Phi) {
             Phi phi = (Phi) p;
@@ -327,7 +327,7 @@
         }
     }
 
-    public void merge(BlockBegin block, FrameStateAccess other) {
+    public void merge(Merge block, FrameStateAccess other) {
         checkSize(other);
         for (int i = 0; i < valuesSize(); i++) {
             Value x = valueAt(i);
@@ -379,8 +379,8 @@
 
 
     /**
-     * The interface implemented by a client of {@link FrameState#forEachPhi(BlockBegin, PhiProcedure)} and
-     * {@link FrameState#forEachLivePhi(BlockBegin, PhiProcedure)}.
+     * The interface implemented by a client of {@link FrameState#forEachPhi(Merge, PhiProcedure)} and
+     * {@link FrameState#forEachLivePhi(Merge, PhiProcedure)}.
      */
     public static interface PhiProcedure {
         boolean doPhi(Phi phi);
@@ -441,7 +441,7 @@
     }
 
     @Override
-    public BlockBegin block() {
+    public Merge block() {
         return null;
     }
 
--- a/graal/GraalGraph/src/com/oracle/graal/graph/EndNode.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalGraph/src/com/oracle/graal/graph/EndNode.java	Fri May 27 11:08:55 2011 +0200
@@ -43,7 +43,7 @@
     }
 
     @Override
-    public void replace(Node other) {
+    public Node replace(Node other) {
         throw new UnsupportedOperationException();
     }
 
--- a/graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java	Fri May 27 11:08:55 2011 +0200
@@ -24,7 +24,6 @@
 
 import java.util.AbstractList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Iterator;
 
 public class NodeArray extends AbstractList<Node> {
--- a/graal/GraalGraph/src/com/oracle/graal/graph/StartNode.java	Thu May 26 11:55:16 2011 +0200
+++ b/graal/GraalGraph/src/com/oracle/graal/graph/StartNode.java	Fri May 27 11:08:55 2011 +0200
@@ -52,7 +52,7 @@
     }
 
     @Override
-    public void replace(Node other) {
+    public Node replace(Node other) {
         throw new UnsupportedOperationException();
     }