changeset 2755:80b024e75b29

small fix for dead blocks
author Lukas Stadler <lukas.stadler@jku.at>
date Fri, 20 May 2011 14:50:04 +0200
parents e91608c2daff
children 152b98832b0e
files 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/ExceptionDispatch.java graal/GraalCompiler/src/com/sun/c1x/ir/If.java graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java
diffstat 5 files changed, 12 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Fri May 20 14:34:36 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Fri May 20 14:50:04 2011 +0200
@@ -580,8 +580,9 @@
         }
     }
 
-    protected LIRBlock getLIRBlock(BlockBegin b) {
-        return b.lirBlock();
+    protected LIRBlock getLIRBlock(Instruction b) {
+        assert b instanceof BlockBegin : "only BlockBegin, for now...";
+        return ((BlockBegin) b).lirBlock();
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Fri May 20 14:34:36 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Fri May 20 14:50:04 2011 +0200
@@ -1178,7 +1178,7 @@
         while ((block = removeFromWorkList()) != null) {
 
             // remove blocks that have no predecessors by the time it their bytecodes are parsed
-            if (block.firstInstruction.predecessors().size() == 0) {
+            if (block.firstInstruction == null) {
                 markVisited(block);
                 continue;
             }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java	Fri May 20 14:34:36 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java	Fri May 20 14:50:04 2011 +0200
@@ -101,17 +101,6 @@
         return blockSuccessor(istrue ? 1 : 0);
     }
 
-    /**
-     * Swaps the successor blocks to this if and negates the condition (e.g. == goes to !=)
-     * @see Condition#negate()
-     */
-    public void swapSuccessors() {
-        BlockBegin t = blockSuccessor(0);
-        BlockBegin f = blockSuccessor(1);
-        setBlockSuccessor(0, f);
-        setBlockSuccessor(1, t);
-    }
-
     @Override
     public void accept(ValueVisitor v) {
         v.visitExceptionDispatch(this);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/If.java	Fri May 20 14:34:36 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/If.java	Fri May 20 14:50:04 2011 +0200
@@ -116,7 +116,7 @@
      * Gets the block corresponding to the true successor.
      * @return the true successor
      */
-    public BlockBegin trueSuccessor() {
+    public Instruction trueSuccessor() {
         return blockSuccessor(0);
     }
 
@@ -124,7 +124,7 @@
      * Gets the block corresponding to the false successor.
      * @return the false successor
      */
-    public BlockBegin falseSuccessor() {
+    public Instruction falseSuccessor() {
         return blockSuccessor(1);
     }
 
@@ -133,7 +133,7 @@
      * @param istrue {@code true} if the true successor is requested, {@code false} otherwise
      * @return the corresponding successor
      */
-    public BlockBegin successor(boolean istrue) {
+    public Instruction successor(boolean istrue) {
         return blockSuccessor(istrue ? 0 : 1);
     }
 
@@ -141,7 +141,7 @@
      * Gets the successor of this instruction for the unordered case.
      * @return the successor for unordered inputs
      */
-    public BlockBegin unorderedSuccessor() {
+    public Instruction unorderedSuccessor() {
         return successor(unorderedIsTrue());
     }
 
@@ -163,8 +163,8 @@
     public void swapSuccessors() {
         unorderedIsTrue = !unorderedIsTrue;
         condition = condition.negate();
-        BlockBegin t = blockSuccessor(0);
-        BlockBegin f = blockSuccessor(1);
+        Instruction t = blockSuccessor(0);
+        Instruction f = blockSuccessor(1);
         setBlockSuccessor(0, f);
         setBlockSuccessor(1, t);
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java	Fri May 20 14:34:36 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java	Fri May 20 14:50:04 2011 +0200
@@ -74,8 +74,8 @@
         return (BlockBegin) successors().get(super.successorCount() + SUCCESSOR_EXCEPTION_EDGE);
     }
 
-    public BlockBegin setExceptionEdge(BlockBegin n) {
-        return (BlockBegin) successors().set(super.successorCount() + SUCCESSOR_EXCEPTION_EDGE, n);
+    public Instruction setExceptionEdge(Instruction n) {
+        return (Instruction) successors().set(super.successorCount() + SUCCESSOR_EXCEPTION_EDGE, n);
     }
 
     public final int opcode;