changeset 2625:62ff4a70f07e

merge
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 10 May 2011 14:39:54 +0200
parents 8e44074058af (current diff) 91d3952f7eb7 (diff)
children 4663477045cb
files graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java
diffstat 35 files changed, 179 insertions(+), 236 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java	Tue May 10 14:39:54 2011 +0200
@@ -546,7 +546,7 @@
         }
         out.print("tid ").print(i).println(COLUMN_END);
 
-        String state = stateToString(i.stateBefore(), null);
+        String state = stateToString(i.stateAfter(), null);
         if (state != null) {
             out.print("st ").print(HOVER_START).print("st").print(HOVER_SEP).print(state).print(HOVER_END).println(COLUMN_END);
         }
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/InstructionPrinter.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/InstructionPrinter.java	Tue May 10 14:39:54 2011 +0200
@@ -143,7 +143,7 @@
             out.print("  [flags: " + flags + "]");
         }
         if (instruction instanceof StateSplit) {
-            out.print("  [state: " + ((StateSplit) instruction).stateBefore() + "]");
+            out.print("  [state: " + ((StateSplit) instruction).stateAfter() + "]");
         }
         out.println();
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Tue May 10 14:39:54 2011 +0200
@@ -190,6 +190,7 @@
     protected LIRList lir;
     final VolatileMemoryAccess vma;
     private ArrayList<DeoptimizationStub> deoptimizationStubs;
+    private FrameState lastState;
 
     public LIRGenerator(C1XCompilation compilation) {
         this.compilation = compilation;
@@ -225,8 +226,12 @@
         this.currentBlock = block;
 
         for (Instruction instr = block; instr != null; instr = instr.next()) {
+            FrameState stateAfter = instr.stateAfter();
+            if (stateAfter != null) {
+                lastState = stateAfter;
+            }
             if (!(instr instanceof BlockBegin)) {
-                walkState(instr, instr.stateBefore());
+                walkState(instr, stateAfter);
                 doRoot(instr);
             }
         }
@@ -251,7 +256,7 @@
     public void visitBase(Base x) {
         // emit phi-instruction move after safepoint since this simplifies
         // describing the state at the safepoint.
-        moveToPhi(x.stateAfter());
+        moveToPhi();
 
         // all blocks with a successor must end with an unconditional jump
         // to the successor even if they are consecutive
@@ -428,10 +433,29 @@
         lir.cmove(i.condition(), tVal, fVal, reg);
     }
 
+    /*protected FrameState stateBeforeInvoke(Invoke invoke) {
+        FrameState stateAfter = invoke.stateAfter();
+        FrameStateBuilder builder = new FrameStateBuilder(compilation.method, invoke.graph());
+        System.out.println("stateBeforeInvoke(" + invoke + "); maxStack=" + compilation.method.maxStackSize());
+        System.out.println("stateAfter=" + stateAfter);
+        builder.initializeFrom(stateAfter);
+        if (invoke.kind != CiKind.Void) {
+            Value pop = builder.pop(invoke.kind);
+            System.out.println("pop " + pop);
+        }
+        int argumentCount = invoke.argumentCount(); // invoke.arguments() iterable?
+        for (int i = 0; i < argumentCount; i++) {
+            Value arg = invoke.argument(i);
+            System.out.println("push " + arg);
+            builder.push(arg.kind, arg);
+        }
+        return builder.create(invoke.bci());
+    }*/
+
     @Override
     public void visitInvoke(Invoke x) {
         RiMethod target = x.target();
-        LIRDebugInfo info = stateFor(x, x.stateBefore());
+        LIRDebugInfo info = stateFor(x);
 
         XirSnippet snippet = null;
 
@@ -500,7 +524,7 @@
     @Override
     public void visitLoadField(LoadField x) {
         RiField field = x.field();
-        LIRDebugInfo info = stateFor(x, x.stateBefore());
+        LIRDebugInfo info = stateFor(x);
         XirArgument receiver = toXirArgument(x.object());
         XirSnippet snippet = x.isStatic() ? xir.genGetStatic(site(x), receiver, field) : xir.genGetField(site(x), receiver, field);
         emitXir(snippet, x, info, null, true);
@@ -550,7 +574,7 @@
         setNoResult(x);
 
         if (x.isSafepoint()) {
-            emitXir(xir.genSafepoint(site(x)), x, stateFor(x, x.stateAfter()), null, false);
+            emitXir(xir.genSafepoint(site(x)), x, stateFor(x), null, false);
         }
 
         // move values into phi locations
@@ -589,7 +613,7 @@
         if (x.kind.isVoid()) {
             XirSnippet epilogue = xir.genEpilogue(site(x), compilation.method);
             if (epilogue != null) {
-                emitXir(epilogue, x, stateFor(x, x.stateAfter()), compilation.method, false);
+                emitXir(epilogue, x, stateFor(x), compilation.method, false);
                 lir.returnOp(IllegalValue);
             }
         } else {
@@ -785,7 +809,7 @@
     @Override
     public void visitStoreField(StoreField x) {
         RiField field = x.field();
-        LIRDebugInfo info = stateFor(x, x.stateBefore());
+        LIRDebugInfo info = stateFor(x);
 
         if (x.isVolatile()) {
             vma.preVolatileWrite();
@@ -813,7 +837,7 @@
         setNoResult(x);
 
         if (x.isSafepoint()) {
-            emitXir(xir.genSafepoint(site(x)), x, stateFor(x, x.stateAfter()), null, false);
+            emitXir(xir.genSafepoint(site(x)), x, stateFor(x), null, false);
         }
 
         // move values into phi locations
@@ -845,7 +869,7 @@
     public void visitThrow(Throw x) {
         setNoResult(x);
         CiValue exceptionOpr = load(x.exception());
-        LIRDebugInfo info = stateFor(x, x.stateAfter());
+        LIRDebugInfo info = stateFor(x);
 
         // check if the instruction has an xhandler in any of the nested scopes
         boolean unwind = false;
@@ -969,8 +993,12 @@
 
     @Override
     public void visitRegisterFinalizer(RegisterFinalizer x) {
-        CiValue receiver = load(x.object());
-        LIRDebugInfo info = stateFor(x, x.stateBefore());
+        Value object = x.object();
+        CiValue receiver = load(object);
+        FrameStateBuilder builder = new FrameStateBuilder(compilation.method, x.graph());
+        builder.initializeFrom(x.stateAfter());
+        builder.push(object.kind, object);
+        LIRDebugInfo info = stateFor(x, builder.create(x.bci()));
         callRuntime(CiRuntimeCall.RegisterFinalizer, info, receiver);
         setNoResult(x);
     }
@@ -1266,6 +1294,11 @@
         }
     }
 
+    protected void moveToPhi() {
+        assert lastState != null;
+        this.moveToPhi(lastState);
+    }
+
     protected void moveToPhi(FrameState curState) {
         // Moves all stack values into their phi position
         BlockBegin bb = currentBlock;
@@ -1378,7 +1411,10 @@
             return;
         }
         for (int index = 0; index < state.stackSize(); index++) {
-            walkStateValue(state.stackAt(index));
+            Value value = state.stackAt(index);
+            if (value != x) {
+                walkStateValue(value);
+            }
         }
         FrameState s = state;
         int bci = x.bci();
@@ -1414,16 +1450,15 @@
     }
 
     protected LIRDebugInfo maybeStateFor(Instruction x) {
-        FrameState stateBefore = x.stateBefore();
-        if (stateBefore == null) {
+        if (lastState == null) {
             return null;
         }
-        return stateFor(x, stateBefore);
+        return stateFor(x, lastState);
     }
 
     protected LIRDebugInfo stateFor(Instruction x) {
-        assert x.stateBefore() != null : "must have state before instruction for " + x;
-        return stateFor(x, x.stateBefore());
+        assert lastState != null : "must have state before instruction for " + x;
+        return stateFor(x, lastState);
     }
 
     protected LIRDebugInfo stateFor(Instruction x, FrameState state) {
@@ -1431,6 +1466,7 @@
             state = compilation.placeholderState;
         }
 
+        assert state != null;
         return new LIRDebugInfo(state, x.exceptionHandlers());
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java	Tue May 10 14:39:54 2011 +0200
@@ -118,7 +118,6 @@
     private Instruction lastInstr;                 // the last instruction added
     private final LogStream log;
 
-    private boolean skipBlock;                     // skip processing of the rest of this block
     private Value rootMethodSynchronizedObject;
 
     private final Graph graph;
@@ -262,10 +261,8 @@
         }
 
         ArrayList<ExceptionHandler> exceptionHandlers = new ArrayList<ExceptionHandler>();
-        FrameState stateBefore = x.stateBefore();
 
-        assert stateBefore != null : "exception handler state must be available for " + x;
-        FrameState state = stateBefore;
+        FrameState state = frameState.create(bci);
         assert bci == Instruction.SYNCHRONIZATION_ENTRY_BCI || bci == bci() : "invalid bci";
 
         // join with all potential exception handlers
@@ -469,17 +466,17 @@
     }
 
     void genArithmeticOp(CiKind kind, int opcode) {
-        genArithmeticOp(kind, opcode, null);
+        genArithmeticOp(kind, opcode, false);
     }
 
-    void genArithmeticOp(CiKind kind, int opcode, FrameState state) {
-        genArithmeticOp(kind, opcode, kind, kind, state);
+    void genArithmeticOp(CiKind kind, int opcode, boolean canTrap) {
+        genArithmeticOp(kind, opcode, kind, kind, canTrap);
     }
 
-    void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, FrameState state) {
+    void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, boolean canTrap) {
         Value yValue = frameState.pop(y);
         Value xValue = frameState.pop(x);
-        Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method().accessFlags()), state, graph));
+        Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method().accessFlags()), canTrap, graph));
         frameState.push(result, result1);
     }
 
@@ -519,7 +516,7 @@
         int delta = stream().readIncrement();
         Value x = frameState.localAt(index);
         Value y = append(Constant.forInt(delta, graph));
-        frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), null, graph)));
+        frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), false, graph)));
     }
 
     void genGoto(int fromBCI, int toBCI) {
@@ -531,7 +528,7 @@
         BlockBegin tsucc = blockAt(stream().readBranchDest());
         BlockBegin fsucc = blockAt(stream().nextBCI());
         int bci = stream().currentBCI();
-        boolean isSafepoint = !noSafepoints() && tsucc.bci() <= bci || fsucc.bci() <= bci;
+        boolean isSafepoint = !noSafepoints() && (tsucc.bci() <= bci || fsucc.bci() <= bci);
         append(new If(x, cond, y, tsucc, fsucc, isSafepoint ? stateBefore : null, isSafepoint, graph));
     }
 
@@ -557,8 +554,7 @@
     }
 
     void genThrow(int bci) {
-        FrameState stateBefore = frameState.create(bci());
-        Throw t = new Throw(frameState.apop(), stateBefore, !noSafepoints(), graph);
+        Throw t = new Throw(frameState.apop(), !noSafepoints(), graph);
         appendWithoutOptimization(t, bci);
     }
 
@@ -567,7 +563,7 @@
         RiType type = constantPool().lookupType(cpi, CHECKCAST);
         boolean isInitialized = !C1XOptions.TestPatching && type.isResolved() && type.isInitialized();
         Value typeInstruction = genResolveClass(RiType.Representation.ObjectHub, type, isInitialized, cpi);
-        CheckCast c = new CheckCast(type, typeInstruction, frameState.apop(), null, graph);
+        CheckCast c = new CheckCast(type, typeInstruction, frameState.apop(), graph);
         frameState.apush(append(c));
         checkForDirectCompare(c);
     }
@@ -577,7 +573,7 @@
         RiType type = constantPool().lookupType(cpi, INSTANCEOF);
         boolean isInitialized = !C1XOptions.TestPatching && type.isResolved() && type.isInitialized();
         Value typeInstruction = genResolveClass(RiType.Representation.ObjectHub, type, isInitialized, cpi);
-        InstanceOf i = new InstanceOf(type, typeInstruction, frameState.apop(), null, graph);
+        InstanceOf i = new InstanceOf(type, typeInstruction, frameState.apop(), graph);
         frameState.ipush(append(i));
         checkForDirectCompare(i);
     }
@@ -590,9 +586,8 @@
     }
 
     void genNewInstance(int cpi) {
-        FrameState stateBefore = frameState.create(bci());
         RiType type = constantPool().lookupType(cpi, NEW);
-        NewInstance n = new NewInstance(type, cpi, constantPool(), stateBefore, graph);
+        NewInstance n = new NewInstance(type, cpi, constantPool(), graph);
         if (memoryMap != null) {
             memoryMap.newInstance(n);
         }
@@ -600,28 +595,25 @@
     }
 
     void genNewTypeArray(int typeCode) {
-        FrameState stateBefore = frameState.create(bci());
         CiKind kind = CiKind.fromArrayTypeCode(typeCode);
         RiType elementType = compilation.runtime.asRiType(kind);
-        frameState.apush(append(new NewTypeArray(frameState.ipop(), elementType, stateBefore, graph)));
+        frameState.apush(append(new NewTypeArray(frameState.ipop(), elementType, graph)));
     }
 
     void genNewObjectArray(int cpi) {
         RiType type = constantPool().lookupType(cpi, ANEWARRAY);
-        FrameState stateBefore = frameState.create(bci());
-        NewArray n = new NewObjectArray(type, frameState.ipop(), stateBefore, graph);
+        NewArray n = new NewObjectArray(type, frameState.ipop(), graph);
         frameState.apush(append(n));
     }
 
     void genNewMultiArray(int cpi) {
         RiType type = constantPool().lookupType(cpi, MULTIANEWARRAY);
-        FrameState stateBefore = frameState.create(bci());
         int rank = stream().readUByte(bci() + 3);
         Value[] dims = new Value[rank];
         for (int i = rank - 1; i >= 0; i--) {
             dims[i] = frameState.ipop();
         }
-        NewArray n = new NewMultiArray(type, dims, stateBefore, cpi, constantPool(), graph);
+        NewArray n = new NewMultiArray(type, dims, cpi, constantPool(), graph);
         frameState.apush(append(n));
     }
 
@@ -1098,6 +1090,14 @@
 
         assert x.next() == null : "instruction should not have been appended yet";
         assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")";
+
+        if (lastInstr instanceof StateSplit) {
+            StateSplit stateSplit = (StateSplit) lastInstr;
+            if (stateSplit.stateAfter() == null) {
+                stateSplit.setStateAfter(frameState.create(bci));
+            }
+        }
+
         if (lastInstr instanceof Base) {
             assert false : "may only happen when inlining intrinsics";
         } else {
@@ -1113,13 +1113,6 @@
             memoryMap.kill();
         }
 
-        if (x instanceof StateSplit) {
-            StateSplit stateSplit = (StateSplit) x;
-            if (stateSplit.stateBefore() == null) {
-                stateSplit.setStateBefore(frameState.create(bci));
-            }
-        }
-
         if (x.canTrap()) {
             // connect the instruction to any exception handlers
             x.setExceptionHandlers(handleException(x, bci));
@@ -1164,7 +1157,7 @@
         frameState.initializeFrom(syncHandler.stateBefore());
 
         int bci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
-        Value exception = appendWithoutOptimization(new ExceptionObject(frameState.create(bci), graph), bci);
+        Value exception = appendWithoutOptimization(new ExceptionObject(graph), bci);
 
         assert lock != null;
         assert frameState.locksSize() > 0 && frameState.lockAt(locksSize() - 1) == lock;
@@ -1207,7 +1200,6 @@
     }
 
     private BlockEnd iterateBytecodesForBlock(int bci, boolean inliningIntoCurrentBlock) {
-        skipBlock = false;
         assert frameState != null;
         stream.setBCI(bci);
 
@@ -1239,8 +1231,7 @@
 
             // push an exception object onto the stack if we are parsing an exception handler
             if (pushException) {
-                FrameState stateBefore = frameState.create(bci());
-                frameState.apush(append(new ExceptionObject(stateBefore, graph)));
+                frameState.apush(append(new ExceptionObject(graph)));
                 pushException = false;
             }
 
@@ -1259,12 +1250,6 @@
             blockStart = false;
         }
 
-        // stop processing of this block
-        if (skipBlock) {
-            skipBlock = false;
-            return (BlockEnd) lastInstr;
-        }
-
         // if the method terminates, we don't need the stack anymore
         if (end instanceof Return || end instanceof Throw) {
             frameState.clearStack();
@@ -1273,12 +1258,13 @@
         // connect to begin and set state
         // NOTE that inlining may have changed the block we are parsing
         assert end != null : "end should exist after iterating over bytecodes";
-        end.setStateAfter(frameState.create(bci()));
+        FrameState stateAtEnd = frameState.create(bci());
+        end.setStateAfter(stateAtEnd);
         curBlock.setEnd(end);
         // propagate the state
         for (BlockBegin succ : end.blockSuccessors()) {
             assert succ.blockPredecessors().contains(curBlock);
-            succ.mergeOrClone(end.stateAfter(), method());
+            succ.mergeOrClone(stateAtEnd, method());
             addToWorkList(succ);
         }
         return end;
@@ -1407,12 +1393,12 @@
             case ISUB           : // fall through
             case IMUL           : genArithmeticOp(CiKind.Int, opcode); break;
             case IDIV           : // fall through
-            case IREM           : genArithmeticOp(CiKind.Int, opcode, frameState.create(bci())); break;
+            case IREM           : genArithmeticOp(CiKind.Int, opcode, true); break;
             case LADD           : // fall through
             case LSUB           : // fall through
             case LMUL           : genArithmeticOp(CiKind.Long, opcode); break;
             case LDIV           : // fall through
-            case LREM           : genArithmeticOp(CiKind.Long, opcode, frameState.create(bci())); break;
+            case LREM           : genArithmeticOp(CiKind.Long, opcode, true); break;
             case FADD           : // fall through
             case FSUB           : // fall through
             case FMUL           : // fall through
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java	Tue May 10 14:39:54 2011 +0200
@@ -66,8 +66,8 @@
      * @param successorCount
      * @param graph
      */
-    public AccessArray(CiKind kind, Value array, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
-        super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    public AccessArray(CiKind kind, Value array, FrameState stateAfter, int inputCount, int successorCount, Graph graph) {
+        super(kind, stateAfter, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         setArray(array);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java	Tue May 10 14:39:54 2011 +0200
@@ -72,8 +72,8 @@
      * @param successorCount
      * @param graph
      */
-    public AccessField(CiKind kind, Value object, RiField field, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
-        super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    public AccessField(CiKind kind, Value object, RiField field, FrameState stateAfter, int inputCount, int successorCount, Graph graph) {
+        super(kind, stateAfter, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         assert object != null : "every field access must reference some object";
         this.field = field;
         setObject(object);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java	Tue May 10 14:39:54 2011 +0200
@@ -86,8 +86,8 @@
      * @param successorCount
      * @param graph
      */
-    AccessIndexed(CiKind kind, Value array, Value index, Value length, CiKind elementType, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
-        super(kind, array, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    AccessIndexed(CiKind kind, Value array, Value index, Value length, CiKind elementType, FrameState stateAfter, int inputCount, int successorCount, Graph graph) {
+        super(kind, array, stateAfter, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         setIndex(index);
         setLength(length);
         this.elementType = elementType;
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessMonitor.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessMonitor.java	Tue May 10 14:39:54 2011 +0200
@@ -85,8 +85,8 @@
      * @param successorCount
      * @param graph
      */
-    public AccessMonitor(Value object, Value lockAddress, FrameState stateBefore, int lockNumber, int inputCount, int successorCount, Graph graph) {
-        super(CiKind.Illegal, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    public AccessMonitor(Value object, Value lockAddress, FrameState stateAfter, int lockNumber, int inputCount, int successorCount, Graph graph) {
+        super(CiKind.Illegal, stateAfter, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         this.lockNumber = lockNumber;
         setObject(object);
         setLockAddress(lockAddress);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArithmeticOp.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ArithmeticOp.java	Tue May 10 14:39:54 2011 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.bytecode.*;
 import com.sun.cri.ci.*;
 
@@ -33,33 +32,10 @@
  */
 public final class ArithmeticOp extends Op2 {
 
-    private static final int INPUT_COUNT = 1;
-    private static final int INPUT_STATE_BEFORE = 0;
-
+    private static final int INPUT_COUNT = 0;
     private static final int SUCCESSOR_COUNT = 0;
 
-    @Override
-    protected int inputCount() {
-        return super.inputCount() + INPUT_COUNT;
-    }
-
-    @Override
-    protected int successorCount() {
-        return super.successorCount() + SUCCESSOR_COUNT;
-    }
-
-    /**
-     * The state for this instruction.
-     */
-     @Override
-    public FrameState stateBefore() {
-        return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
-    }
-
-    private FrameState setStateBefore(FrameState n) {
-        return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n);
-    }
-
+    private final boolean canTrap;
     private final boolean isStrictFP;
 
     /**
@@ -71,10 +47,10 @@
      * @param isStrictFP indicates this operation has strict rounding semantics
      * @param stateBefore the state for instructions that may trap
      */
-    public ArithmeticOp(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, FrameState stateBefore, Graph graph) {
+    public ArithmeticOp(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, boolean canTrap, Graph graph) {
         super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.isStrictFP = isStrictFP;
-        setStateBefore(stateBefore);
+        this.canTrap = canTrap;
     }
 
     /**
@@ -92,7 +68,7 @@
      */
     @Override
     public boolean canTrap() {
-        return stateBefore() != null;
+        return canTrap;
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java	Tue May 10 14:39:54 2011 +0200
@@ -42,10 +42,10 @@
     /**
      * Constructs a new ArrayLength instruction.
      * @param array the instruction producing the array
-     * @param newFrameState the state before executing this instruction
+     * @param newFrameState the state after executing this instruction
      */
-    public ArrayLength(Value array, FrameState newFrameState, Graph graph) {
-        super(CiKind.Int, array, newFrameState, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public ArrayLength(Value array, FrameState stateAfter, Graph graph) {
+        super(CiKind.Int, array, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java	Tue May 10 14:39:54 2011 +0200
@@ -60,7 +60,6 @@
     /**
      * The frame state before execution of the first instruction in this block.
      */
-     @Override
     public FrameState stateBefore() {
         return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
     }
@@ -125,6 +124,8 @@
      */
     private int blockFlags;
 
+    private FrameState stateAfter;
+
     /**
      * The {@link BlockBegin} nodes for which this node is a successor.
      */
@@ -214,6 +215,15 @@
         return loopIndex;
     }
 
+    public void setStateAfter(FrameState stateAfter) {
+        this.stateAfter = stateAfter;
+    }
+
+    @Override
+    public FrameState stateAfter() {
+        return stateAfter;
+    }
+
     /**
      * Gets the exception handlers that cover one or more instructions of this basic block.
      *
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java	Tue May 10 14:39:54 2011 +0200
@@ -25,7 +25,6 @@
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.util.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.bytecode.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -45,8 +44,8 @@
      * @param stateBefore the state before the cast
      * @param graph
      */
-    public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore, Graph graph) {
-        super(targetClass, targetClassInstruction, object, CiKind.Object, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, Graph graph) {
+        super(targetClass, targetClassInstruction, object, CiKind.Object, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         initFlag(Flag.NonNull, object.isNonNull());
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionObject.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionObject.java	Tue May 10 14:39:54 2011 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 
 /**
@@ -36,24 +35,13 @@
     private static final int SUCCESSOR_COUNT = 0;
 
     /**
-     * Debug info is required if safepoints are placed at exception handlers.
-     */
-    public final FrameState stateBefore;
-
-    /**
      * Constructs a new ExceptionObject instruction.
      * @param stateBefore TODO
      * @param graph
      */
-    public ExceptionObject(FrameState stateBefore, Graph graph) {
+    public ExceptionObject(Graph graph) {
         super(CiKind.Object, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setFlag(Flag.NonNull);
-        this.stateBefore = stateBefore;
-    }
-
-    @Override
-    public FrameState stateBefore() {
-        return stateBefore;
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java	Tue May 10 14:39:54 2011 +0200
@@ -25,7 +25,6 @@
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.util.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.bytecode.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
@@ -45,8 +44,8 @@
      * @param stateBefore the state before this instruction
      * @param graph
      */
-    public InstanceOf(RiType targetClass, Value targetClassInstruction, Value object, FrameState stateBefore, Graph graph) {
-        super(targetClass, targetClassInstruction, object, CiKind.Int, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public InstanceOf(RiType targetClass, Value targetClassInstruction, Value object, Graph graph) {
+        super(targetClass, targetClassInstruction, object, CiKind.Int, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java	Tue May 10 14:39:54 2011 +0200
@@ -237,10 +237,6 @@
      */
     public final void allValuesDo(ValueClosure closure) {
         inputValuesDo(closure);
-        FrameState stateBefore = stateBefore();
-        if (stateBefore != null) {
-            stateBefore.inputValuesDo(closure);
-        }
         FrameState stateAfter = stateAfter();
         if (stateAfter != null) {
             stateAfter.inputValuesDo(closure);
@@ -248,14 +244,6 @@
     }
 
     /**
-     * Gets the state before the instruction, if it is recorded.
-     * @return the state before the instruction
-     */
-    public FrameState stateBefore() {
-        return null;
-    }
-
-    /**
      * Gets the state after the instruction, if it is recorded. Typically only
      * instances of {@link BlockEnd} have a non-null state after.
      * @return the state after the instruction
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java	Tue May 10 14:39:54 2011 +0200
@@ -80,8 +80,8 @@
      * @param target the target method being called
      * @param stateBefore the state before executing the invocation
      */
-    public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, FrameState stateBefore, Graph graph) {
-        super(result, stateBefore, args.length, SUCCESSOR_COUNT, graph);
+    public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, FrameState stateAfter, Graph graph) {
+        super(result, stateAfter, args.length, SUCCESSOR_COUNT, graph);
         this.opcode = opcode;
         this.target = target;
         this.returnType = returnType;
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java	Tue May 10 14:39:54 2011 +0200
@@ -41,12 +41,12 @@
      * @param object the receiver object
      * @param field the compiler interface field
      * @param isStatic indicates if the field is static
-     * @param stateBefore the state before the field access
+     * @param stateAfter the state after the field access
      * @param graph
      * @param isLoaded indicates if the class is loaded
      */
-    public LoadField(Value object, RiField field, FrameState stateBefore, Graph graph) {
-        super(field.kind().stackKind(), object, field, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public LoadField(Value object, RiField field, FrameState stateAfter, Graph graph) {
+        super(field.kind().stackKind(), object, field, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     /**
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java	Tue May 10 14:39:54 2011 +0200
@@ -42,11 +42,11 @@
      * @param index the instruction producing the index
      * @param length the instruction producing the length
      * @param elementType the element type
-     * @param stateBefore the state before executing this instruction
+     * @param stateAfter the after before executing this instruction
      * @param graph
      */
-    public LoadIndexed(Value array, Value index, Value length, CiKind elementType, FrameState stateBefore, Graph graph) {
-        super(elementType.stackKind(), array, index, length, elementType, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public LoadIndexed(Value array, Value index, Value length, CiKind elementType, FrameState stateAfter, Graph graph) {
+        super(elementType.stackKind(), array, index, length, elementType, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     /**
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java	Tue May 10 14:39:54 2011 +0200
@@ -34,12 +34,6 @@
     private static final int INPUT_COUNT = 0;
 
     private static final int SUCCESSOR_COUNT = 1;
-    private static final int SUCCESSOR_STATE_AFTER = 0;
-
-    @Override
-    protected int inputCount() {
-        return super.inputCount() + INPUT_COUNT;
-    }
 
     @Override
     protected int successorCount() {
@@ -47,28 +41,16 @@
     }
 
     /**
-     * The state for this instruction.
-     */
-     @Override
-    public FrameState stateAfter() {
-        return (FrameState) successors().get(super.successorCount() + SUCCESSOR_STATE_AFTER);
-    }
-
-    public FrameState setStateAfter(FrameState n) {
-        return (FrameState) successors().set(super.successorCount() + SUCCESSOR_STATE_AFTER, n);
-    }
-
-    /**
      * Creates a new MonitorEnter instruction.
      *
      * @param object the instruction producing the object
      * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
      * @param lockNumber the number of the lock
-     * @param stateBefore the state before
+     * @param stateAfter the state after
      * @param graph
      */
-    public MonitorEnter(Value object, Value lockAddress, int lockNumber, FrameState stateBefore, Graph graph) {
-        super(object, lockAddress, stateBefore, lockNumber, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public MonitorEnter(Value object, Value lockAddress, int lockNumber, FrameState stateAfter, Graph graph) {
+        super(object, lockAddress, stateAfter, lockNumber, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java	Tue May 10 14:39:54 2011 +0200
@@ -40,11 +40,11 @@
      * @param object the instruction produces the object value
      * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack
      * @param lockNumber the number of the lock
-     * @param stateBefore the state before executing this instruction
+     * @param stateBefore the state after executing this instruction
      * @param graph
      */
-    public MonitorExit(Value object, Value lockAddress, int lockNumber, FrameState stateBefore, Graph graph) {
-        super(object, lockAddress, stateBefore, lockNumber, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public MonitorExit(Value object, Value lockAddress, int lockNumber, FrameState stateAfter, Graph graph) {
+        super(object, lockAddress, stateAfter, lockNumber, INPUT_COUNT, SUCCESSOR_COUNT, graph);
     }
 
     @Override
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java	Tue May 10 14:39:54 2011 +0200
@@ -23,13 +23,12 @@
 package com.sun.c1x.ir;
 
 import com.oracle.graal.graph.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 
 /**
  * The {@code NewArray} class is the base of all instructions that allocate arrays.
  */
-public abstract class NewArray extends StateSplit {
+public abstract class NewArray extends Instruction {
 
     private static final int INPUT_COUNT = 1;
     private static final int INPUT_LENGTH = 0;
@@ -65,10 +64,14 @@
      * @param successorCount
      * @param graph
      */
-    NewArray(Value length, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
-        super(CiKind.Object, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    NewArray(Value length, int inputCount, int successorCount, Graph graph) {
+        super(CiKind.Object, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         setFlag(Flag.NonNull);
         setLength(length);
     }
 
+    @Override
+    public boolean canTrap() {
+        return true;
+    }
 }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java	Tue May 10 14:39:54 2011 +0200
@@ -24,14 +24,13 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
 
 /**
  * The {@code NewInstance} instruction represents the allocation of an instance class object.
  */
-public final class NewInstance extends StateSplit {
+public final class NewInstance extends Instruction {
 
     private static final int INPUT_COUNT = 0;
     private static final int SUCCESSOR_COUNT = 0;
@@ -47,8 +46,8 @@
      * @param stateBefore the state before executing this instruction
      * @param graph
      */
-    public NewInstance(RiType type, int cpi, RiConstantPool constantPool, FrameState stateBefore, Graph graph) {
-        super(CiKind.Object, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public NewInstance(RiType type, int cpi, RiConstantPool constantPool, Graph graph) {
+        super(CiKind.Object, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.instanceClass = type;
         this.cpi = cpi;
         this.constantPool = constantPool;
@@ -74,6 +73,11 @@
     }
 
     @Override
+    public boolean canTrap() {
+        return true;
+    }
+
+    @Override
     public void accept(ValueVisitor v) {
         v.visitNewInstance(this);
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java	Tue May 10 14:39:54 2011 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
 
@@ -81,8 +80,8 @@
      * @param riConstantPool the constant pool for resolution
      * @param graph
      */
-    public NewMultiArray(RiType elementKind, Value[] dimensions, FrameState stateBefore, int cpi, RiConstantPool riConstantPool, Graph graph) {
-        super(null, stateBefore, dimensions.length, SUCCESSOR_COUNT, graph);
+    public NewMultiArray(RiType elementKind, Value[] dimensions, int cpi, RiConstantPool riConstantPool, Graph graph) {
+        super(null, dimensions.length, SUCCESSOR_COUNT, graph);
         this.constantPool = riConstantPool;
         this.elementKind = elementKind;
         this.cpi = cpi;
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java	Tue May 10 14:39:54 2011 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
 
@@ -45,8 +44,8 @@
      * @param stateBefore the state before the allocation
      * @param graph
      */
-    public NewObjectArray(RiType elementClass, Value length, FrameState stateBefore, Graph graph) {
-        super(length, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public NewObjectArray(RiType elementClass, Value length, Graph graph) {
+        super(length, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.elementClass = elementClass;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java	Tue May 10 14:39:54 2011 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
 
@@ -38,8 +37,8 @@
 
     final RiType elementType;
 
-    public NewTypeArray(Value length, RiType elementType, FrameState stateBefore, Graph graph) {
-        super(length, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public NewTypeArray(Value length, RiType elementType, Graph graph) {
+        super(length, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.elementType = elementType;
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java	Tue May 10 14:39:54 2011 +0200
@@ -25,14 +25,13 @@
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
 import com.sun.c1x.util.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.bytecode.*;
 import com.sun.cri.ri.*;
 
 /**
  * The {@code NullCheck} class represents an explicit null check instruction.
  */
-public final class NullCheck extends StateSplit {
+public final class NullCheck extends Instruction {
 
     private static final int INPUT_COUNT = 1;
     private static final int INPUT_OBJECT = 0;
@@ -66,8 +65,8 @@
      * @param stateBefore the state before executing the null check
      * @param graph
      */
-    public NullCheck(Value object, FrameState stateBefore, Graph graph) {
-        super(object.kind, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public NullCheck(Value object, Graph graph) {
+        super(object.kind, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setFlag(Flag.NonNull);
         setObject(object);
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java	Tue May 10 14:39:54 2011 +0200
@@ -58,8 +58,8 @@
         return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n);
     }
 
-    public RegisterFinalizer(Value object, FrameState stateBefore, Graph graph) {
-        super(CiKind.Void, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public RegisterFinalizer(Value object, FrameState stateAfter, Graph graph) {
+        super(CiKind.Void, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setObject(object);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ResolveClass.java	Tue May 10 14:39:54 2011 +0200
@@ -40,8 +40,8 @@
     public final RiType type;
     public final RiType.Representation portion;
 
-    public ResolveClass(RiType type, RiType.Representation r, FrameState stateBefore, Graph graph) {
-        super(type.getRepresentationKind(r), stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public ResolveClass(RiType type, RiType.Representation r, FrameState stateAfter, Graph graph) {
+        super(type.getRepresentationKind(r), stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         this.portion = r;
         this.type = type;
         setFlag(Flag.NonNull);
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java	Tue May 10 14:39:54 2011 +0200
@@ -33,7 +33,7 @@
 public abstract class StateSplit extends Instruction {
 
     private static final int INPUT_COUNT = 1;
-    private static final int INPUT_STATE_BEFORE = 0;
+    private static final int INPUT_STATE_AFTER = 0;
 
     private static final int SUCCESSOR_COUNT = 0;
 
@@ -51,12 +51,12 @@
      * The state for this instruction.
      */
      @Override
-    public FrameState stateBefore() {
-        return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
+    public FrameState stateAfter() {
+        return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_AFTER);
     }
 
-    public FrameState setStateBefore(FrameState n) {
-        return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n);
+    public FrameState setStateAfter(FrameState n) {
+        return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_AFTER, n);
     }
 
     /**
@@ -66,14 +66,14 @@
      * @param successorCount
      * @param graph
      */
-    public StateSplit(CiKind kind, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
+    public StateSplit(CiKind kind, FrameState stateAfter, int inputCount, int successorCount, Graph graph) {
         super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
-        setStateBefore(stateBefore);
+        this.setStateAfter(stateAfter);
     }
 
     @Override
     public boolean canTrap() {
-        return stateBefore() != null;
+        return true;
     }
 
 }
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java	Tue May 10 14:39:54 2011 +0200
@@ -64,11 +64,11 @@
      * @param object the receiver object
      * @param field the compiler interface field
      * @param value the instruction representing the value to store to the field
-     * @param stateBefore the state before the field access
+     * @param stateAfter the state after the field access
      * @param graph
      */
-    public StoreField(Value object, RiField field, Value value, FrameState stateBefore, Graph graph) {
-        super(CiKind.Void, object, field, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public StoreField(Value object, RiField field, Value value, FrameState stateAfter, Graph graph) {
+        super(CiKind.Void, object, field, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setValue(value);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java	Tue May 10 14:39:54 2011 +0200
@@ -65,11 +65,11 @@
      * @param length the instruction producing the length
      * @param elementType the element type
      * @param value the value to store into the array
-     * @param stateBefore the state before executing this instruction
+     * @param stateAfter the state after executing this instruction
      * @param graph
      */
-    public StoreIndexed(Value array, Value index, Value length, CiKind elementType, Value value, FrameState stateBefore, Graph graph) {
-        super(CiKind.Void, array, index, length, elementType, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph);
+    public StoreIndexed(Value array, Value index, Value length, CiKind elementType, Value value, FrameState stateAfter, Graph graph) {
+        super(CiKind.Void, array, index, length, elementType, stateAfter, INPUT_COUNT, SUCCESSOR_COUNT, graph);
         setValue(value);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java	Tue May 10 14:39:54 2011 +0200
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.graph.*;
 import com.sun.c1x.debug.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 
 /**
@@ -32,9 +31,8 @@
  */
 public final class Throw extends BlockEnd {
 
-    private static final int INPUT_COUNT = 2;
+    private static final int INPUT_COUNT = 1;
     private static final int INPUT_EXCEPTION = 0;
-    private static final int INPUT_STATE_BEFORE = 1;
 
     private static final int SUCCESSOR_COUNT = 0;
 
@@ -60,27 +58,14 @@
     }
 
     /**
-     * The state before this throw would occur.
-     */
-     @Override
-    public FrameState stateBefore() {
-        return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
-    }
-
-    private FrameState setStateBefore(FrameState n) {
-        return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n);
-    }
-
-    /**
      * Creates a new Throw instruction.
      * @param exception the instruction that generates the exception to throw
      * @param stateAfter the state before the exception is thrown but after the exception object has been popped
      * @param isSafepoint {@code true} if this instruction is a safepoint instruction
      * @param graph
      */
-    public Throw(Value exception, FrameState stateAfter, boolean isSafepoint, Graph graph) {
+    public Throw(Value exception, boolean isSafepoint, Graph graph) {
         super(CiKind.Illegal, null, isSafepoint, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph);
-        setStateBefore(stateAfter);
         setException(exception);
     }
 
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java	Tue May 10 14:39:54 2011 +0200
@@ -23,14 +23,13 @@
 package com.sun.c1x.ir;
 
 import com.oracle.graal.graph.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ri.*;
 
 /**
  * The {@code TypeCheck} instruction is the base class of casts and instanceof tests.
  */
-public abstract class TypeCheck extends StateSplit {
+public abstract class TypeCheck extends Instruction {
 
     private static final int INPUT_COUNT = 2;
     private static final int INPUT_OBJECT = 0;
@@ -82,8 +81,8 @@
      * @param successorCount
      * @param graph
      */
-    public TypeCheck(RiType targetClass, Value targetClassInstruction, Value object, CiKind kind, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
-        super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
+    public TypeCheck(RiType targetClass, Value targetClassInstruction, Value object, CiKind kind, int inputCount, int successorCount, Graph graph) {
+        super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
         this.targetClass = targetClass;
         setObject(object);
         setTargetClassInstruction(targetClassInstruction);
--- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIRAssembler.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIRAssembler.java	Tue May 10 14:39:54 2011 +0200
@@ -31,7 +31,6 @@
 import com.sun.c1x.ir.*;
 import com.sun.c1x.lir.FrameMap.StackBlock;
 import com.sun.c1x.util.*;
-import com.sun.c1x.value.*;
 import com.sun.cri.ci.*;
 import com.sun.cri.ci.CiTargetMethod.Mark;
 import com.sun.cri.ri.*;
@@ -213,13 +212,6 @@
         return true;
     }
 
-    static FrameState stateBefore(Value ins) {
-        if (ins instanceof Instruction) {
-            return ((Instruction) ins).stateBefore();
-        }
-        return null;
-    }
-
     void emitCall(LIRCall op) {
         verifyOopMap(op.info);
 
--- a/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java	Tue May 10 14:29:40 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java	Tue May 10 14:39:54 2011 +0200
@@ -515,7 +515,7 @@
         CiValue left = xin.result();
         CiValue right = yin.result();
         lir.cmp(cond, left, right);
-        moveToPhi(x.stateAfter());
+        moveToPhi();
         if (x.x().kind.isFloat() || x.x().kind.isDouble()) {
             lir.branch(cond, right.kind, x.trueSuccessor(), x.unorderedSuccessor());
         } else {