changeset 2774:93fd92c9f8b0

Removed usage of stateAfter on BlockEnd instructions.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Tue, 24 May 2011 13:39:50 +0200
parents 27512ea6bbcb
children 3b73b230b86b
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/graph/IR.java graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java graal/GraalCompiler/src/com/sun/c1x/ir/Goto.java graal/GraalCompiler/src/com/sun/c1x/ir/If.java graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java graal/GraalCompiler/src/com/sun/c1x/ir/Return.java graal/GraalCompiler/src/com/sun/c1x/ir/Switch.java graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java
diffstat 13 files changed, 39 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Tue May 24 13:39:50 2011 +0200
@@ -1300,15 +1300,16 @@
 
                 List<Phi> phis = getPhis(sux);
 
-                int predIndex = 0;
-                for (; predIndex < sux.numberOfPreds(); ++predIndex) {
-                    if (sux.predAt(predIndex) == bb) {
-                        break;
+                if (phis != null) {
+
+                    int predIndex = 0;
+                    for (; predIndex < sux.numberOfPreds(); ++predIndex) {
+                        if (sux.predAt(predIndex) == bb) {
+                            break;
+                        }
                     }
-                }
-                assert predIndex < sux.numberOfPreds();
+                    assert predIndex < sux.numberOfPreds();
 
-                if (phis != null) {
                     PhiResolver resolver = new PhiResolver(this);
                     for (Phi phi : phis) {
                         if (!phi.isDeadPhi() && phi.valueCount() > predIndex) {
@@ -1328,23 +1329,6 @@
                     }
                     resolver.dispose();
                 }
-
-                /*
-
-                FrameState suxState = sux.stateBefore();
-                TTY.println("number of preds: " + sux.numberOfPreds());
-
-                PhiResolver resolver = new PhiResolver(this);
-
-
-                for (int index = 0; index < suxState.stackSize(); index++) {
-                    moveToPhi(resolver, curState.stackAt(index), suxState.stackAt(index), phis, predIndex);
-                }
-
-                for (int index = 0; index < suxState.localsSize(); index++) {
-                    moveToPhi(resolver, curState.localAt(index), suxState.localAt(index), phis, predIndex);
-                }
-                resolver.dispose();*/
             }
         }
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Tue May 24 13:39:50 2011 +0200
@@ -281,9 +281,8 @@
 
     private void finishStartBlock(Block startBlock) {
         assert bci() == 0;
-        FrameState stateAfter = frameState.create(bci());
-        Instruction target = createTargetAt(0, stateAfter);
-        Goto base = new Goto(target, stateAfter, graph);
+        Instruction target = createTargetAt(0, frameState);
+        Goto base = new Goto(target, graph);
         appendWithBCI(base);
     }
 
@@ -420,7 +419,7 @@
             FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception);
 
             Instruction successor = createTarget(dispatchBlock, stateWithException);
-            BlockEnd end = new Goto(successor, stateWithException, graph);
+            BlockEnd end = new Goto(successor, graph);
             exception.appendNext(end);
 
             if (x instanceof Invoke) {
@@ -603,12 +602,12 @@
     }
 
     private void genGoto(int fromBCI, int toBCI) {
-        append(new Goto(createTargetAt(toBCI, frameState), null, graph));
+        append(new Goto(createTargetAt(toBCI, frameState), graph));
     }
 
     private void ifNode(Value x, Condition cond, Value y) {
         assert !x.isDeleted() && !y.isDeleted();
-        If ifNode = new If(x, cond, y, null, graph);
+        If ifNode = new If(x, cond, y, graph);
         append(ifNode);
         Instruction tsucc = createTargetAt(stream().readBranchDest(), frameState);
         ifNode.setBlockSuccessor(0, tsucc);
@@ -992,7 +991,7 @@
         int offset = ts.defaultOffset();
         list.add(null);
         offsetList.add(offset);
-        TableSwitch tableSwitch = new TableSwitch(value, list, ts.lowKey(), null, graph);
+        TableSwitch tableSwitch = new TableSwitch(value, list, ts.lowKey(), graph);
         for (int i = 0; i < offsetList.size(); ++i) {
             tableSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState));
         }
@@ -1017,7 +1016,7 @@
         int offset = ls.defaultOffset();
         list.add(null);
         offsetList.add(offset);
-        LookupSwitch lookupSwitch = new LookupSwitch(value, list, keys, null, graph);
+        LookupSwitch lookupSwitch = new LookupSwitch(value, list, keys, graph);
         for (int i = 0; i < offsetList.size(); ++i) {
             lookupSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState));
         }
@@ -1157,13 +1156,13 @@
             if (block.handler.catchType().isResolved()) {
                 Instruction catchSuccessor = createTarget(block.handlerBlock, frameState);
                 Instruction nextDispatch = createTarget(block.next, frameState);
-                append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), frameState.duplicate(bci()), graph));
+                append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), graph));
             } else {
                 Deoptimize deopt = new Deoptimize(graph);
                 deopt.setMessage("unresolved " + block.handler.catchType().name());
                 append(deopt);
                 Instruction nextDispatch = createTarget(block.next, frameState);
-                append(new Goto(nextDispatch, frameState.duplicate(bci()), graph));
+                append(new Goto(nextDispatch, graph));
             }
         }
     }
@@ -1183,7 +1182,7 @@
             if (nextBlock != null && nextBlock != block) {
                 // we fell through to the next block, add a goto and break
                 Instruction next = createTarget(nextBlock, frameState);
-                end = new Goto(next, null, graph);
+                end = new Goto(next, graph);
                 lastInstr = lastInstr.appendNext(end);
                 break;
             }
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue May 24 13:39:50 2011 +0200
@@ -230,17 +230,10 @@
         }
 
         // This goto is not a safepoint.
-        Goto e = new Goto(target, null, compilation.graph);
+        Goto e = new Goto(target, compilation.graph);
         newSucc.appendNext(e);
         e.reorderSuccessor(0, backEdgeIndex);
 
-        // setup states
-        FrameState s = source.end().stateAfter();
-        newSucc.setStateBefore(s);
-        e.setStateAfter(s);
-        assert newSucc.stateBefore().localsSize() == s.localsSize();
-        assert newSucc.stateBefore().stackSize() == s.stackSize();
-        assert newSucc.stateBefore().locksSize() == s.locksSize();
         // link predecessor to new block
         source.end().substituteSuccessor(target, newSucc);
         if (removePhiInputs.size() > 0) {
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java	Tue May 24 13:39:50 2011 +0200
@@ -90,24 +90,22 @@
     /**
      * Constructs a new block end with the specified value type.
      * @param kind the type of the value produced by this instruction
-     * @param stateAfter the frame state at the end of this block
      * @param successors the list of successor blocks. If {@code null}, a new one will be created.
      */
-    public BlockEnd(CiKind kind, FrameState stateAfter, List<? extends Instruction> blockSuccessors, int inputCount, int successorCount, Graph graph) {
-        this(kind, stateAfter, blockSuccessors.size(), inputCount, successorCount, graph);
+    public BlockEnd(CiKind kind, List<? extends Instruction> blockSuccessors, int inputCount, int successorCount, Graph graph) {
+        this(kind, blockSuccessors.size(), inputCount, successorCount, graph);
         for (int i = 0; i < blockSuccessors.size(); i++) {
             setBlockSuccessor(i, blockSuccessors.get(i));
         }
     }
 
-    public BlockEnd(CiKind kind, FrameState stateAfter, int blockSuccessorCount, int inputCount, int successorCount, Graph graph) {
+    public BlockEnd(CiKind kind, int blockSuccessorCount, int inputCount, int successorCount, Graph graph) {
         super(kind, inputCount + INPUT_COUNT, successorCount + blockSuccessorCount + SUCCESSOR_COUNT, graph);
         this.blockSuccessorCount = blockSuccessorCount;
-        setStateAfter(stateAfter);
     }
 
-    public BlockEnd(CiKind kind, FrameState stateAfter, Graph graph) {
-        this(kind, stateAfter, 2, 0, 0, graph);
+    public BlockEnd(CiKind kind, Graph graph) {
+        this(kind, 2, 0, 0, graph);
     }
 
     /**
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java	Tue May 24 13:39:50 2011 +0200
@@ -65,8 +65,8 @@
     /**
      * Constructs a new ExceptionDispatch instruction.
      */
-    public ExceptionDispatch(Value exception, Instruction catchSuccessor, Instruction otherSuccessor, RiType catchType, FrameState stateAfter, Graph graph) {
-        super(CiKind.Int, stateAfter, 2, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public ExceptionDispatch(Value exception, Instruction catchSuccessor, Instruction otherSuccessor, RiType catchType, Graph graph) {
+        super(CiKind.Int, 2, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setException(exception);
         setBlockSuccessor(0, otherSuccessor);
         setBlockSuccessor(1, catchSuccessor);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Goto.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Goto.java	Tue May 24 13:39:50 2011 +0200
@@ -41,8 +41,8 @@
      * @param stateAfter the frame state at the end of this block
      * @param graph
      */
-    public Goto(Instruction succ, FrameState stateAfter, Graph graph) {
-        super(CiKind.Illegal, stateAfter, 1, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public Goto(Instruction succ, Graph graph) {
+        super(CiKind.Illegal, 1, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setBlockSuccessor(0, succ);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/If.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/If.java	Tue May 24 13:39:50 2011 +0200
@@ -83,8 +83,8 @@
      * @param stateAfter the state before the branch but after the input values have been popped
      * @param graph
      */
-    public If(Value x, Condition cond, Value y, FrameState stateAfter, Graph graph) {
-        super(CiKind.Illegal, stateAfter, 2, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public If(Value x, Condition cond, Value y, Graph graph) {
+        super(CiKind.Illegal, 2, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         assert Util.archKindsEqual(x, y);
         condition = cond;
         setX(x);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java	Tue May 24 13:39:50 2011 +0200
@@ -49,8 +49,8 @@
      * @param stateAfter the state after the switch
      * @param graph
      */
-    public LookupSwitch(Value value, List<? extends Instruction> successors, int[] keys, FrameState stateAfter, Graph graph) {
-        super(value, successors, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public LookupSwitch(Value value, List<? extends Instruction> successors, int[] keys, Graph graph) {
+        super(value, successors, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.keys = keys;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Return.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Return.java	Tue May 24 13:39:50 2011 +0200
@@ -70,7 +70,7 @@
      * @param graph
      */
     public Return(Value result, Graph graph) {
-        super(result == null ? CiKind.Void : result.kind, null, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+        super(result == null ? CiKind.Void : result.kind, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setResult(result);
         successors().set(SUCCESSOR_END, graph.end());
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Switch.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Switch.java	Tue May 24 13:39:50 2011 +0200
@@ -66,8 +66,8 @@
      * @param stateAfter the state after the switch
      * @param graph
      */
-    public Switch(Value value, List<? extends Instruction> successors, FrameState stateAfter, int inputCount, int successorCount, Graph graph) {
-        super(CiKind.Illegal, stateAfter, successors, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    public Switch(Value value, List<? extends Instruction> successors, int inputCount, int successorCount, Graph graph) {
+        super(CiKind.Illegal, successors, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         setValue(value);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java	Tue May 24 13:39:50 2011 +0200
@@ -48,8 +48,8 @@
      * @param stateAfter the state after the switch
      * @param graph
      */
-    public TableSwitch(Value value, List<? extends Instruction> successors, int lowKey, FrameState stateAfter, Graph graph) {
-        super(value, successors, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public TableSwitch(Value value, List<? extends Instruction> successors, int lowKey, Graph graph) {
+        super(value, successors, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.lowKey = lowKey;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java	Tue May 24 13:39:50 2011 +0200
@@ -91,7 +91,7 @@
      * @param graph
      */
     public Throw(Value exception, Graph graph) {
-        super(CiKind.Illegal, null, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+        super(CiKind.Illegal, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setException(exception);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java	Tue May 24 12:07:17 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java	Tue May 24 13:39:50 2011 +0200
@@ -65,7 +65,7 @@
     }
 
     public Unwind(Value exception, Graph graph) {
-        super(CiKind.Object, null, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+        super(CiKind.Object, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setException(exception);
         successors().set(SUCCESSOR_END, graph.end());
     }