diff graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2773:27512ea6bbcb

exception dispatch simplification: * BlockMap creates exception dispatch blocks (so they're iterated in the right order) * GraphBuilder uses exception dispatch blocks, simplified handleException, removed updateDispatchChain * simplified mergeOrClone * removed successor & predecessor methods from BlockBegin
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 24 May 2011 12:07:17 +0200
parents 43ffa0e47a46
children 93ec3f067420 bda5972a40a5
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java	Tue May 24 10:27:15 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java	Tue May 24 12:07:17 2011 +0200
@@ -97,19 +97,6 @@
     }
 
     /**
-     * Gets the list of predecessors of this block.
-     * @return the predecessor list
-     */
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public List<Instruction> blockPredecessors() {
-        if (predecessors().size() == 1 && predecessors().get(0) == graph().start()) {
-            return Collections.EMPTY_LIST;
-        } else {
-            return (List) Collections.unmodifiableList(predecessors());
-        }
-    }
-
-    /**
      * Gets the linear scan number of this block.
      * @return the linear scan number
      */
@@ -147,10 +134,8 @@
             Instruction inst = this;
             ArrayList<BlockBegin> excBlocks = new ArrayList<BlockBegin>();
             while (inst != null) {
-                if (inst instanceof Invoke) {
-                    excBlocks.add(((Invoke) inst).exceptionEdge());
-                } else if (inst instanceof Throw) {
-                    excBlocks.add(((Throw) inst).exceptionEdge());
+                if (inst instanceof ExceptionEdgeInstruction) {
+                    excBlocks.add(((ExceptionEdgeInstruction) inst).exceptionEdge());
                 }
                 inst = inst.next();
             }
@@ -202,40 +187,6 @@
         return builder.toString();
     }
 
-    /**
-     * Get the number of successors.
-     * @return the number of successors
-     */
-    public int numberOfSux() {
-        return end().blockSuccessorCount();
-    }
-
-    /**
-     * Get the successor at a certain position.
-     * @param i the position
-     * @return the successor
-     */
-    public BlockBegin suxAt(int i) {
-        return end().blockSuccessor(i);
-    }
-
-    /**
-     * Get the number of predecessors.
-     * @return the number of predecessors
-     */
-    public int numberOfPreds() {
-        // ignore the graph root
-        if (predecessors().size() == 1 && predecessors().get(0) == graph().start()) {
-            return 0;
-        } else {
-            return predecessors().size();
-        }
-    }
-
-    public Instruction predAt(int j) {
-        return (Instruction) predecessors().get(j);
-    }
-
     public void printWithoutPhis(LogStream out) {
         // print block id
         BlockEnd end = end();
@@ -397,13 +348,14 @@
      * Iterates over all successors of this block: successors of the end node and exception handler.
      */
     public void allSuccessorsDo(boolean backwards, BlockClosure closure) {
+        BlockEnd end = end();
         if (backwards) {
-            for (int i = numberOfSux() - 1; i >= 0; i--) {
-                closure.apply(suxAt(i));
+            for (int i = end.blockSuccessorCount() - 1; i >= 0; i--) {
+                closure.apply(end.blockSuccessor(i));
             }
         } else {
-            for (int i = 0; i < numberOfSux(); i++) {
-                closure.apply(suxAt(i));
+            for (int i = 0; i < end.blockSuccessorCount(); i++) {
+                closure.apply(end.blockSuccessor(i));
             }
         }
         for (Instruction x = next(); x != null; x = x.next()) {