changeset 12415:083e90f11c93

Merge
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Tue, 15 Oct 2013 02:07:33 +0200
parents 98031e66de15 (current diff) edacadae40a0 (diff)
children 9ad59f7fd57e 808348377021
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameAccessNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java
diffstat 34 files changed, 186 insertions(+), 788 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -82,7 +82,7 @@
 
     @Override
     public void simplify(SimplifierTool tool) {
-        if (condition instanceof LogicNegationNode) {
+        while (condition instanceof LogicNegationNode) {
             LogicNegationNode negation = (LogicNegationNode) condition;
             setCondition(negation.getInput());
             negated = !negated;
@@ -100,7 +100,7 @@
                 deopt.setDeoptimizationState(getDeoptimizationState());
                 setNext(deopt);
             }
-            this.replaceAtUsages(BeginNode.prevBegin(this));
+            this.replaceAtUsages(null);
             graph().removeFixed(this);
         }
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -34,7 +34,7 @@
  * A node that changes the stamp of its input based on some condition being true.
  */
 @NodeInfo(nameTemplate = "GuardingPi(!={p#negated}) {p#reason/s}")
-public class GuardingPiNode extends FixedWithNextNode implements Lowerable, GuardingNode, Canonicalizable, ValueProxy {
+public class GuardingPiNode extends FixedWithNextNode implements Lowerable, Virtualizable, GuardingNode, Canonicalizable, ValueProxy {
 
     @Input private ValueNode object;
     @Input private LogicNode condition;
@@ -85,6 +85,14 @@
     }
 
     @Override
+    public void virtualize(VirtualizerTool tool) {
+        State state = tool.getObjectState(object);
+        if (state != null && state.getState() == EscapeState.Virtual && ObjectStamp.typeOrNull(this).isAssignableFrom(state.getVirtualObject().type())) {
+            tool.replaceWithVirtual(state.getVirtualObject());
+        }
+    }
+
+    @Override
     public boolean inferStamp() {
         return updateStamp(stamp().join(object().stamp()));
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -462,8 +462,8 @@
         List<AbstractEndNode> mergePredecessors = merge.cfgPredecessors().snapshot();
         assert phi.valueCount() == merge.forwardEndCount();
 
-        Constant[] xs = constantValues(compare.x(), merge);
-        Constant[] ys = constantValues(compare.y(), merge);
+        Constant[] xs = constantValues(compare.x(), merge, false);
+        Constant[] ys = constantValues(compare.y(), merge, false);
         if (xs == null || ys == null) {
             return false;
         }
@@ -607,7 +607,7 @@
      * @return null if {@code node} is neither a {@link ConstantNode} nor a {@link PhiNode} whose
      *         input values are all constants
      */
-    private static Constant[] constantValues(ValueNode node, MergeNode merge) {
+    public static Constant[] constantValues(ValueNode node, MergeNode merge, boolean allowNull) {
         if (node.isConstant()) {
             Constant[] result = new Constant[merge.forwardEndCount()];
             Arrays.fill(result, node.asConstant());
@@ -620,7 +620,7 @@
                 Constant[] result = new Constant[merge.forwardEndCount()];
                 int i = 0;
                 for (ValueNode n : phi.values()) {
-                    if (!n.isConstant()) {
+                    if (!allowNull && !n.isConstant()) {
                         return null;
                     }
                     result[i++] = n.asConstant();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -185,7 +185,7 @@
 
     @Override
     public void setDeoptimizationState(FrameState f) {
-        throw new IllegalStateException();
+        throw new IllegalStateException("Cannot set deoptimization state " + f + " for invoke " + this);
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -35,7 +35,7 @@
  * information, i.e., an unsafe cast is removed if the input object has a more precise or equal type
  * than the type this nodes casts to.
  */
-public class UnsafeCastNode extends FloatingGuardedNode implements LIRLowerable, GuardingNode, IterableNodeType, Canonicalizable, ValueProxy {
+public class UnsafeCastNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, GuardingNode, IterableNodeType, Canonicalizable, ValueProxy {
 
     @Input private ValueNode object;
 
@@ -86,6 +86,14 @@
     }
 
     @Override
+    public void virtualize(VirtualizerTool tool) {
+        State state = tool.getObjectState(object);
+        if (state != null && state.getState() == EscapeState.Virtual && ObjectStamp.typeOrNull(this).isAssignableFrom(state.getVirtualObject().type())) {
+            tool.replaceWithVirtual(state.getVirtualObject());
+        }
+    }
+
+    @Override
     public void generate(LIRGeneratorTool generator) {
         assert kind() == Kind.Object && object.kind() == Kind.Object;
         /*
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -63,8 +63,11 @@
             if (offsetValue.isConstant()) {
                 long offset = offsetValue.asConstant().asLong();
                 int entryIndex = state.getVirtualObject().entryIndexForOffset(offset);
-                if (entryIndex != -1 && state.getVirtualObject().entryKind(entryIndex) == accessKind()) {
-                    tool.replaceWith(state.getEntry(entryIndex));
+                if (entryIndex != -1) {
+                    ValueNode entry = state.getEntry(entryIndex);
+                    if (entry.kind() == accessKind() || state.getVirtualObject().entryKind(entryIndex) == accessKind()) {
+                        tool.replaceWith(entry);
+                    }
                 }
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -80,9 +80,12 @@
             if (indexValue.isConstant()) {
                 long offset = indexValue.asConstant().asLong();
                 int entryIndex = state.getVirtualObject().entryIndexForOffset(offset);
-                if (entryIndex != -1 && state.getVirtualObject().entryKind(entryIndex) == accessKind()) {
-                    tool.setVirtualEntry(state, entryIndex, value());
-                    tool.delete();
+                if (entryIndex != -1) {
+                    ValueNode entry = state.getEntry(entryIndex);
+                    if (entry.kind() == this.accessKind() || state.getVirtualObject().entryKind(entryIndex) == this.accessKind()) {
+                        tool.setVirtualEntry(state, entryIndex, value());
+                        tool.delete();
+                    }
                 }
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -74,7 +74,8 @@
             int index = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1;
             if (index >= 0 && index < arrayState.getVirtualObject().entryCount()) {
                 ResolvedJavaType componentType = arrayState.getVirtualObject().type().getComponentType();
-                if (componentType.isPrimitive() || ObjectStamp.isObjectAlwaysNull(value) || (ObjectStamp.typeOrNull(value) != null && componentType.isAssignableFrom(ObjectStamp.typeOrNull(value)))) {
+                if (componentType.isPrimitive() || ObjectStamp.isObjectAlwaysNull(value) || componentType.getSuperclass() == null ||
+                                (ObjectStamp.typeOrNull(value) != null && componentType.isAssignableFrom(ObjectStamp.typeOrNull(value)))) {
                     tool.setVirtualEntry(arrayState, index, value());
                     tool.delete();
                 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Tue Oct 15 02:07:33 2013 +0200
@@ -24,9 +24,11 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 
@@ -45,7 +47,7 @@
  */
 public class ConvertDeoptimizeToGuardPhase extends Phase {
 
-    private static AbstractBeginNode findBeginNode(Node startNode) {
+    private static AbstractBeginNode findBeginNode(FixedNode startNode) {
         Node n = startNode;
         while (true) {
             if (n instanceof AbstractBeginNode) {
@@ -64,16 +66,50 @@
 
         for (DeoptimizeNode d : graph.getNodes(DeoptimizeNode.class)) {
             assert d.isAlive();
-            visitDeoptBegin(findBeginNode(d), d, graph);
+            visitDeoptBegin(BeginNode.prevBegin(d), d.action(), d.reason(), graph);
+        }
+
+        for (FixedGuardNode fixedGuard : graph.getNodes(FixedGuardNode.class)) {
+
+            AbstractBeginNode pred = BeginNode.prevBegin(fixedGuard);
+            if (pred instanceof MergeNode) {
+                MergeNode merge = (MergeNode) pred;
+                if (fixedGuard.condition() instanceof CompareNode) {
+                    CompareNode compare = (CompareNode) fixedGuard.condition();
+                    List<AbstractEndNode> mergePredecessors = merge.cfgPredecessors().snapshot();
+
+                    Constant[] xs = IfNode.constantValues(compare.x(), merge, true);
+                    if (xs == null) {
+                        continue;
+                    }
+                    Constant[] ys = IfNode.constantValues(compare.y(), merge, true);
+                    if (ys == null) {
+                        continue;
+                    }
+                    for (int i = 0; i < mergePredecessors.size(); ++i) {
+                        AbstractEndNode mergePredecessor = mergePredecessors.get(i);
+                        if (xs[i] == null) {
+                            continue;
+                        }
+                        if (ys[i] == null) {
+                            continue;
+                        }
+                        if (xs[i].getKind() != Kind.Object && ys[i].getKind() != Kind.Object &&
+                                        compare.condition().foldCondition(xs[i], ys[i], null, compare.unorderedIsTrue()) == fixedGuard.isNegated()) {
+                            visitDeoptBegin(BeginNode.prevBegin(mergePredecessor), fixedGuard.getAction(), fixedGuard.getReason(), graph);
+                        }
+                    }
+                }
+            }
         }
 
         new DeadCodeEliminationPhase().apply(graph);
     }
 
-    private void visitDeoptBegin(AbstractBeginNode deoptBegin, DeoptimizeNode deopt, StructuredGraph graph) {
+    private void visitDeoptBegin(AbstractBeginNode deoptBegin, DeoptimizationAction deoptAction, DeoptimizationReason deoptReason, StructuredGraph graph) {
         if (deoptBegin instanceof MergeNode) {
             MergeNode mergeNode = (MergeNode) deoptBegin;
-            Debug.log("Visiting %s followed by %s", mergeNode, deopt);
+            Debug.log("Visiting %s", mergeNode);
             List<AbstractBeginNode> begins = new ArrayList<>();
             for (AbstractEndNode end : mergeNode.forwardEnds()) {
                 AbstractBeginNode newBeginNode = findBeginNode(end);
@@ -82,7 +118,7 @@
             }
             for (AbstractBeginNode begin : begins) {
                 assert !begin.isDeleted();
-                visitDeoptBegin(begin, deopt, graph);
+                visitDeoptBegin(begin, deoptAction, deoptReason, graph);
             }
             assert mergeNode.isDeleted();
             return;
@@ -90,7 +126,7 @@
             IfNode ifNode = (IfNode) deoptBegin.predecessor();
             AbstractBeginNode otherBegin = ifNode.trueSuccessor();
             LogicNode conditionNode = ifNode.condition();
-            FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), deoptBegin == ifNode.trueSuccessor()));
+            FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deoptReason, deoptAction, deoptBegin == ifNode.trueSuccessor()));
             FixedWithNextNode pred = (FixedWithNextNode) ifNode.predecessor();
             AbstractBeginNode survivingSuccessor;
             if (deoptBegin == ifNode.trueSuccessor()) {
@@ -115,7 +151,7 @@
                     }
                 }
             }
-            Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s.", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin);
+            Debug.log("Converting deopt on %-5s branch of %s to guard for remaining branch %s.", deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin);
             FixedNode next = pred.next();
             pred.setNext(guard);
             guard.setNext(next);
@@ -126,8 +162,8 @@
         FixedWithNextNode deoptPred = deoptBegin;
         FixedNode next = deoptPred.next();
 
-        if (next != deopt) {
-            DeoptimizeNode newDeoptNode = (DeoptimizeNode) deopt.clone(graph);
+        if (!(next instanceof DeoptimizeNode)) {
+            DeoptimizeNode newDeoptNode = graph.add(new DeoptimizeNode(deoptAction, deoptReason));
             deoptPred.setNext(newDeoptNode);
             assert deoptPred == newDeoptNode.predecessor();
             GraphUtil.killCFG(next);
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/StoreLocalTestNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/StoreLocalTestNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -38,11 +38,7 @@
     @Override
     public int execute(VirtualFrame frame) {
         int value = valueNode.execute(frame);
-        try {
-            frame.setInt(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException(e);
-        }
+        frame.setInt(slot, value);
         return value;
     }
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java	Tue Oct 15 02:07:33 2013 +0200
@@ -36,8 +36,6 @@
  */
 public final class FrameWithoutBoxing implements VirtualFrame, MaterializedFrame, PackedFrame {
 
-    private static final Unsafe unsafe = Unsafe.getUnsafe();
-
     private final FrameDescriptor descriptor;
     private final PackedFrame caller;
     private final Arguments arguments;
@@ -87,17 +85,17 @@
     }
 
     private Object getObjectUnsafe(FrameSlot slot) {
-        return unsafe.getObject(locals, (long) slot.getIndex() * Unsafe.ARRAY_OBJECT_INDEX_SCALE + Unsafe.ARRAY_OBJECT_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetObject(locals, (long) slot.getIndex() * Unsafe.ARRAY_OBJECT_INDEX_SCALE + Unsafe.ARRAY_OBJECT_BASE_OFFSET, true, slot);
     }
 
     @Override
     public void setObject(FrameSlot slot, Object value) {
-        verifySetObject(slot);
+        verifySet(slot, FrameSlotKind.Object);
         setObjectUnsafe(slot, value);
     }
 
     private void setObjectUnsafe(FrameSlot slot, Object value) {
-        unsafe.putObject(locals, (long) slot.getIndex() * Unsafe.ARRAY_OBJECT_INDEX_SCALE + Unsafe.ARRAY_OBJECT_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutObject(locals, (long) slot.getIndex() * Unsafe.ARRAY_OBJECT_INDEX_SCALE + Unsafe.ARRAY_OBJECT_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -107,17 +105,17 @@
     }
 
     private byte getByteUnsafe(FrameSlot slot) {
-        return unsafe.getByte(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetByte(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot);
     }
 
     @Override
-    public void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException {
+    public void setByte(FrameSlot slot, byte value) {
         verifySet(slot, FrameSlotKind.Byte);
         setByteUnsafe(slot, value);
     }
 
     private void setByteUnsafe(FrameSlot slot, byte value) {
-        unsafe.putByte(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutByte(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -127,17 +125,17 @@
     }
 
     private boolean getBooleanUnsafe(FrameSlot slot) {
-        return unsafe.getBoolean(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetBoolean(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot);
     }
 
     @Override
-    public void setBoolean(FrameSlot slot, boolean value) throws FrameSlotTypeException {
+    public void setBoolean(FrameSlot slot, boolean value) {
         verifySet(slot, FrameSlotKind.Boolean);
         setBooleanUnsafe(slot, value);
     }
 
     private void setBooleanUnsafe(FrameSlot slot, boolean value) {
-        unsafe.putBoolean(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutBoolean(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -147,17 +145,17 @@
     }
 
     private float getFloatUnsafe(FrameSlot slot) {
-        return unsafe.getFloat(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetFloat(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot);
     }
 
     @Override
-    public void setFloat(FrameSlot slot, float value) throws FrameSlotTypeException {
+    public void setFloat(FrameSlot slot, float value) {
         verifySet(slot, FrameSlotKind.Float);
         setFloatUnsafe(slot, value);
     }
 
     private void setFloatUnsafe(FrameSlot slot, float value) {
-        unsafe.putFloat(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutFloat(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -167,17 +165,17 @@
     }
 
     private long getLongUnsafe(FrameSlot slot) {
-        return unsafe.getLong(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetLong(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot);
     }
 
     @Override
-    public void setLong(FrameSlot slot, long value) throws FrameSlotTypeException {
+    public void setLong(FrameSlot slot, long value) {
         verifySet(slot, FrameSlotKind.Long);
         setLongUnsafe(slot, value);
     }
 
     private void setLongUnsafe(FrameSlot slot, long value) {
-        unsafe.putLong(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutLong(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -187,17 +185,17 @@
     }
 
     private int getIntUnsafe(FrameSlot slot) {
-        return unsafe.getInt(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetInt(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot);
     }
 
     @Override
-    public void setInt(FrameSlot slot, int value) throws FrameSlotTypeException {
+    public void setInt(FrameSlot slot, int value) {
         verifySet(slot, FrameSlotKind.Int);
         setIntUnsafe(slot, value);
     }
 
     private void setIntUnsafe(FrameSlot slot, int value) {
-        unsafe.putInt(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutInt(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -207,17 +205,17 @@
     }
 
     private double getDoubleUnsafe(FrameSlot slot) {
-        return unsafe.getDouble(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+        return CompilerDirectives.unsafeGetDouble(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot);
     }
 
     @Override
-    public void setDouble(FrameSlot slot, double value) throws FrameSlotTypeException {
+    public void setDouble(FrameSlot slot, double value) {
         verifySet(slot, FrameSlotKind.Double);
         setDoubleUnsafe(slot, value);
     }
 
     private void setDoubleUnsafe(FrameSlot slot, double value) {
-        unsafe.putDouble(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
+        CompilerDirectives.unsafePutDouble(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value, slot);
     }
 
     @Override
@@ -225,16 +223,7 @@
         return this.descriptor;
     }
 
-    private void verifySet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException {
-        FrameSlotKind slotKind = slot.getKind();
-        if (slotKind != accessKind) {
-            CompilerDirectives.transferToInterpreter();
-            if (slotKind == FrameSlotKind.Illegal) {
-                slot.setKind(accessKind);
-            } else {
-                throw new FrameSlotTypeException();
-            }
-        }
+    private void verifySet(FrameSlot slot, FrameSlotKind accessKind) {
         int slotIndex = slot.getIndex();
         if (slotIndex >= tags.length) {
             CompilerDirectives.transferToInterpreter();
@@ -243,27 +232,14 @@
         tags[slotIndex] = (byte) accessKind.ordinal();
     }
 
-    private void verifySetObject(FrameSlot slot) {
-        if (slot.getKind() != FrameSlotKind.Object) {
-            CompilerDirectives.transferToInterpreter();
-            slot.setKind(FrameSlotKind.Object);
-        }
-        int slotIndex = slot.getIndex();
-        if (slotIndex >= tags.length) {
-            CompilerDirectives.transferToInterpreter();
-            resize();
-        }
-        tags[slotIndex] = (byte) FrameSlotKind.Object.ordinal();
-    }
-
     private void verifyGet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException {
         int slotIndex = slot.getIndex();
         if (slotIndex >= tags.length) {
             CompilerDirectives.transferToInterpreter();
             resize();
         }
-        byte tag = tags[slotIndex];
-        if (accessKind == FrameSlotKind.Object ? (tag & 0xfe) != 0 : tag != accessKind.ordinal()) {
+        byte tag = this.tags[slotIndex];
+        if (accessKind == FrameSlotKind.Object ? tag != 0 : tag != accessKind.ordinal()) {
             CompilerDirectives.transferToInterpreter();
             if (slot.getKind() == accessKind || tag == 0) {
                 descriptor.getTypeConversion().updateFrameSlot(this, slot, getValue(slot));
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Tue Oct 15 02:07:33 2013 +0200
@@ -183,6 +183,12 @@
     @Override
     public void nodeReplaced() {
         replaceCount++;
+        if (compiledMethod != null) {
+            if (compiledMethod.isValid()) {
+                compiledMethod.invalidate();
+            }
+            compiledMethod = null;
+        }
         compilationPolicy.nodeReplaced();
     }
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Tue Oct 15 02:07:33 2013 +0200
@@ -164,7 +164,7 @@
                 }
 
                 // EA frame and clean up.
-                new PartialEscapePhase(false, canonicalizer).apply(graph, tierContext);
+                new PartialEscapePhase(true, canonicalizer).apply(graph, tierContext);
                 new VerifyNoIntrinsicsLeftPhase().apply(graph, false);
                 for (MaterializeFrameNode materializeNode : graph.getNodes(MaterializeFrameNode.class).snapshot()) {
                     materializeNode.replaceAtUsages(materializeNode.getFrame());
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Tue Oct 15 02:07:33 2013 +0200
@@ -60,9 +60,9 @@
     @Option(help = "")
     public static final OptionValue<Integer> TruffleInliningMaxRecursiveDepth = new OptionValue<>(2);
     @Option(help = "")
-    public static final OptionValue<Integer> TruffleInliningMaxCallerSize = new OptionValue<>(600);
+    public static final OptionValue<Integer> TruffleInliningMaxCallerSize = new OptionValue<>(2500);
     @Option(help = "")
-    public static final OptionValue<Integer> TruffleInliningMaxCalleeSize = new OptionValue<>(62);
+    public static final OptionValue<Integer> TruffleInliningMaxCalleeSize = new OptionValue<>(250);
     @Option(help = "")
     public static final OptionValue<Integer> TruffleInliningTrivialSize = new OptionValue<>(10);
     @Option(help = "")
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameAccessNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.truffle.nodes.frame;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.truffle.*;
-import com.oracle.graal.truffle.nodes.*;
-import com.oracle.graal.truffle.substitutions.*;
-import com.oracle.truffle.api.frame.*;
-
-/**
- * Base node class for the intrinsic nodes for read and write access to a Truffle frame.
- */
-public abstract class FrameAccessNode extends FixedWithNextNode implements Simplifiable {
-
-    @Input private ValueNode frame;
-    @Input private ValueNode slot;
-    protected final ResolvedJavaField field;
-    protected final Kind slotKind;
-
-    public FrameAccessNode(Stamp stamp, Kind slotKind, ValueNode frame, ValueNode slot, ResolvedJavaField field) {
-        super(stamp);
-        this.slotKind = slotKind;
-        this.frame = frame;
-        this.slot = slot;
-        this.field = field;
-    }
-
-    public ValueNode getFrame() {
-        return frame;
-    }
-
-    public ValueNode getSlot() {
-        return slot;
-    }
-
-    public Kind getSlotKind() {
-        return slotKind;
-    }
-
-    protected int getSlotIndex() {
-        return getConstantFrameSlot().getIndex();
-    }
-
-    public boolean isConstantFrameSlot() {
-        return slot.isConstant() && !slot.isNullConstant();
-    }
-
-    protected FrameSlot getConstantFrameSlot() {
-        assert isConstantFrameSlot() : slot;
-        return (FrameSlot) slot.asConstant().asObject();
-    }
-
-    protected final void insertDeoptimization(VirtualizerTool tool) {
-        LogicNode contradiction = LogicConstantNode.contradiction(graph());
-        FixedGuardNode fixedGuard = new FixedGuardNode(contradiction, DeoptimizationReason.UnreachedCode, DeoptimizationAction.InvalidateReprofile);
-        tool.addNode(fixedGuard);
-    }
-
-    @Override
-    public String toString(Verbosity verbosity) {
-        if (verbosity == Verbosity.Name) {
-            return super.toString(verbosity) + getSlotKind().name() + (slot != null && isConstantFrameSlot() ? " " + getConstantFrameSlot() : "");
-        } else {
-            return super.toString(verbosity);
-        }
-    }
-
-    protected final ValueNode getSlotOffset(int scale, MetaAccessProvider metaAccess) {
-        if (isConstantFrameSlot()) {
-            return ConstantNode.forInt(getSlotIndex() * scale, graph());
-        } else {
-            LoadFieldNode loadFrameSlotIndex = graph().add(new LoadFieldNode(getSlot(), metaAccess.lookupJavaField(getFrameSlotIndexField())));
-            graph().addBeforeFixed(this, loadFrameSlotIndex);
-            return scale == 1 ? loadFrameSlotIndex : IntegerArithmeticNode.mul(loadFrameSlotIndex, ConstantNode.forInt(scale, graph()));
-        }
-    }
-
-    private static Field getFrameSlotIndexField() {
-        try {
-            return FrameSlotImpl.class.getDeclaredField("index");
-        } catch (NoSuchFieldException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    protected final boolean isValidAccessKind() {
-        if (isTagAccess()) {
-            return true;
-        }
-
-        return getSlotKind() == getGraalKind(getConstantFrameSlot().getKind());
-    }
-
-    protected final boolean isTagAccess() {
-        return field == FrameWithoutBoxingSubstitutions.TAGS_FIELD;
-    }
-
-    private static Kind getGraalKind(FrameSlotKind kind) {
-        switch (kind) {
-            case Object:
-                return Kind.Object;
-            case Long:
-                return Kind.Long;
-            case Int:
-                return Kind.Int;
-            case Byte:
-                return Kind.Byte;
-            case Double:
-                return Kind.Double;
-            case Float:
-                return Kind.Float;
-            case Boolean:
-                return Kind.Boolean;
-            case Illegal:
-            default:
-                return Kind.Illegal;
-        }
-    }
-
-    @Override
-    public final void simplify(SimplifierTool tool) {
-        if (isConstantFrameSlot()) {
-            if (!isValidAccessKind()) {
-                tool.deleteBranch(this.next());
-                this.replaceAndDelete(graph().add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.UnreachedCode)));
-            } else {
-                tool.assumptions().record(new AssumptionValidAssumption((OptimizedAssumption) getConstantFrameSlot().getFrameDescriptor().getVersion()));
-            }
-        }
-    }
-
-    @Override
-    public Map<Object, Object> getDebugProperties(Map<Object, Object> map) {
-        Map<Object, Object> properties = super.getDebugProperties(map);
-        if (isTagAccess()) {
-            properties.put("slotKind", "Tag");
-        }
-        if (isConstantFrameSlot()) {
-            properties.put("frameSlot", getConstantFrameSlot().toString());
-        }
-        return properties;
-    }
-}
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.truffle.nodes.frame;
-
-import sun.misc.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
-import com.oracle.graal.truffle.*;
-import com.oracle.truffle.api.frame.*;
-
-/**
- * Intrinsic node for read access to a Truffle frame.
- */
-@NodeInfo(nameTemplate = "FrameGet{p#slotKind/s}{p#frameSlot/s}")
-public class FrameGetNode extends FrameAccessNode implements IterableNodeType, Virtualizable, Lowerable {
-
-    public FrameGetNode(Kind kind, ValueNode frame, ValueNode slot, ResolvedJavaField field) {
-        super(StampFactory.forKind(kind), kind, frame, slot, field);
-    }
-
-    @Override
-    public void virtualize(VirtualizerTool tool) {
-        if (!isConstantFrameSlot()) {
-            return;
-        }
-        assert isValidAccessKind();
-        State virtualFrame = tool.getObjectState(getFrame());
-        if (virtualFrame == null || virtualFrame.getState() != EscapeState.Virtual) {
-            return;
-        }
-        assert virtualFrame.getVirtualObject().type() == NewFrameNode.FRAME_TYPE : virtualFrame;
-        VirtualInstanceNode virtualFrameObject = (VirtualInstanceNode) virtualFrame.getVirtualObject();
-        int arrayFieldIndex = virtualFrameObject.fieldIndex(field);
-        State virtualArray = tool.getObjectState(virtualFrame.getEntry(arrayFieldIndex));
-        assert virtualArray != null;
-        ValueNode result = virtualArray.getEntry(getSlotIndex());
-        State virtualResult = tool.getObjectState(result);
-        if (virtualResult != null) {
-            tool.replaceWithVirtual(virtualResult.getVirtualObject());
-        } else {
-            tool.replaceWithValue(result);
-        }
-    }
-
-    @Override
-    public void lower(LoweringTool tool) {
-        assert !(getFrame() instanceof NewFrameNode);
-        StructuredGraph structuredGraph = graph();
-
-        LoadFieldNode loadFieldNode = graph().add(new LoadFieldNode(getFrame(), field));
-        structuredGraph.addBeforeFixed(this, loadFieldNode);
-        FixedWithNextNode loadNode;
-        if (isTagAccess()) {
-            ValueNode slotIndex = getSlotOffset(1, tool.getMetaAccess());
-            loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, getSlotKind()));
-        } else if (!getSlotKind().isPrimitive()) {
-            ValueNode slotIndex = getSlotOffset(1, tool.getMetaAccess());
-            loadNode = graph().add(new LoadIndexedNode(loadFieldNode, slotIndex, Kind.Object));
-        } else {
-            ValueNode slotOffset = graph().unique(
-                            new IntegerAddNode(Kind.Long, getSlotOffset(Unsafe.ARRAY_LONG_INDEX_SCALE, tool.getMetaAccess()), ConstantNode.forLong(Unsafe.ARRAY_LONG_BASE_OFFSET, graph())));
-            loadNode = graph().add(new UnsafeLoadNode(loadFieldNode, slotOffset, getSlotKind()));
-        }
-        structuredGraph.replaceFixedWithFixed(this, loadNode);
-        loadFieldNode.lower(tool);
-        ((Lowerable) loadNode).lower(tool);
-    }
-
-    @NodeIntrinsic
-    public static native <T> T get(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, @ConstantNodeParameter ResolvedJavaField field);
-}
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.truffle.nodes.frame;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
-import com.oracle.graal.truffle.*;
-import com.oracle.truffle.api.frame.*;
-
-/**
- * Intrinsic node for write access to a Truffle frame.
- */
-@NodeInfo(nameTemplate = "FrameSet{p#slotKind/s}{p#frameSlot/s}")
-public class FrameSetNode extends FrameAccessNode implements IterableNodeType, Virtualizable, Lowerable {
-
-    @Input private ValueNode value;
-
-    public FrameSetNode(Kind kind, ValueNode frame, ValueNode frameSlot, ValueNode value, ResolvedJavaField field) {
-        super(StampFactory.forVoid(), kind, frame, frameSlot, field);
-        this.value = value;
-    }
-
-    public ValueNode getValue() {
-        return value;
-    }
-
-    @Override
-    public void virtualize(VirtualizerTool tool) {
-        if (!isConstantFrameSlot()) {
-            return;
-        }
-        assert isValidAccessKind();
-        State virtualFrame = tool.getObjectState(getFrame());
-        if (virtualFrame == null || virtualFrame.getState() != EscapeState.Virtual) {
-            return;
-        }
-        assert virtualFrame.getVirtualObject().type() == NewFrameNode.FRAME_TYPE : virtualFrame;
-        VirtualInstanceNode virtualFrameObject = (VirtualInstanceNode) virtualFrame.getVirtualObject();
-        int arrayFieldIndex = virtualFrameObject.fieldIndex(field);
-        State virtualArray = tool.getObjectState(virtualFrame.getEntry(arrayFieldIndex));
-        assert virtualArray != null;
-        ValueNode storedValue = value;
-        tool.setVirtualEntry(virtualArray, getSlotIndex(), storedValue);
-        tool.delete();
-    }
-
-    @Override
-    public void lower(LoweringTool tool) {
-        assert !(getFrame() instanceof NewFrameNode);
-        StructuredGraph structuredGraph = graph();
-
-        LoadFieldNode loadFieldNode = graph().add(new LoadFieldNode(getFrame(), field));
-        structuredGraph.addBeforeFixed(this, loadFieldNode);
-        FixedWithNextNode storeNode;
-        ValueNode slotIndex = getSlotOffset(1, tool.getMetaAccess());
-        if (isTagAccess()) {
-            storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, getSlotKind(), value));
-        } else if (!getSlotKind().isPrimitive()) {
-            storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, Kind.Object, value));
-        } else {
-            storeNode = graph().add(new StoreIndexedNode(loadFieldNode, slotIndex, Kind.Long, value));
-        }
-        structuredGraph.replaceFixedWithFixed(this, storeNode);
-        loadFieldNode.lower(tool);
-        ((Lowerable) storeNode).lower(tool);
-    }
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, Object value, @ConstantNodeParameter ResolvedJavaField field);
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, byte value, @ConstantNodeParameter ResolvedJavaField field);
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, boolean value, @ConstantNodeParameter ResolvedJavaField field);
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, int value, @ConstantNodeParameter ResolvedJavaField field);
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, long value, @ConstantNodeParameter ResolvedJavaField field);
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, double value, @ConstantNodeParameter ResolvedJavaField field);
-
-    @NodeIntrinsic
-    public static native void set(@ConstantNodeParameter Kind kind, FrameWithoutBoxing frame, FrameSlot slot, float value, @ConstantNodeParameter ResolvedJavaField field);
-}
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -147,7 +147,7 @@
         ResolvedJavaField primitiveLocalsField = findField(frameFields, "primitiveLocals");
         ResolvedJavaField tagsField = findField(frameFields, "tags");
 
-        VirtualObjectNode virtualFrame = new VirtualOnlyInstanceNode(frameType, frameFields);
+        VirtualObjectNode virtualFrame = new VirtualInstanceNode(frameType, frameFields, false);
         VirtualObjectNode virtualFrameObjectArray = new VirtualArrayNode((ResolvedJavaType) localsField.getType().getComponentType(), frameSize);
         VirtualObjectNode virtualFramePrimitiveArray = new VirtualArrayNode((ResolvedJavaType) primitiveLocalsField.getType().getComponentType(), frameSize);
         VirtualObjectNode virtualFrameTagArray = new VirtualArrayNode((ResolvedJavaType) tagsField.getType().getComponentType(), frameSize);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/VerifyFrameDoesNotEscapePhase.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/VerifyFrameDoesNotEscapePhase.java	Tue Oct 15 02:07:33 2013 +0200
@@ -46,12 +46,6 @@
                     throw GraphUtil.approxSourceException(callTarget, exception);
                 }
             }
-            for (FrameAccessNode frameAccess : virtualFrame.usages().filter(FrameAccessNode.class)) {
-                if (!frameAccess.isConstantFrameSlot()) {
-                    Throwable exception = new VerificationError("Frame slot must be compile-time constant in virtual frame access at: %s frameSlot=%s", frameAccess, frameAccess.getSlot());
-                    throw GraphUtil.approxSourceException(frameAccess, exception);
-                }
-            }
         }
     }
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerDirectivesSubstitutions.java	Tue Oct 15 02:07:33 2013 +0200
@@ -29,16 +29,18 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.nodes.*;
 import com.oracle.graal.truffle.nodes.typesystem.*;
 import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.frame.*;
 
 @ClassSubstitution(CompilerDirectives.class)
 public class CompilerDirectivesSubstitutions {
 
     @MethodSubstitution
     public static void transferToInterpreter() {
-        DeoptimizeNode.deopt(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.UnreachedCode);
+        DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.UnreachedCode);
     }
 
     @MethodSubstitution
@@ -66,6 +68,11 @@
     @MacroSubstitution(macro = UnsafeTypeCastMacroNode.class, isStatic = true)
     public static native Object unsafeCast(Object value, Class clazz, boolean condition);
 
+    @MethodSubstitution
+    private static Class<? extends MaterializedFrame> getUnsafeFrameType() {
+        return FrameWithoutBoxing.class;
+    }
+
     @MacroSubstitution(macro = CustomizedUnsafeLoadMacroNode.class, isStatic = true)
     public static native boolean unsafeGetBoolean(Object receiver, long offset, boolean condition, Object locationIdentity);
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java	Tue Oct 15 02:07:33 2013 +0200
@@ -22,218 +22,15 @@
  */
 package com.oracle.graal.truffle.substitutions;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
-import com.oracle.graal.truffle.nodes.frame.*;
-import com.oracle.truffle.api.frame.*;
 
 @ClassSubstitution(FrameWithoutBoxing.class)
 public class FrameWithoutBoxingSubstitutions {
 
-    private static final ResolvedJavaField LOCALS_FIELD;
-    private static final ResolvedJavaField PRIMITIVELOCALS_FIELD;
-    public static final ResolvedJavaField TAGS_FIELD;
-
-    static {
-        try {
-            MetaAccessProvider runtime = Graal.getRequiredCapability(MetaAccessProvider.class);
-            LOCALS_FIELD = runtime.lookupJavaField(FrameWithoutBoxing.class.getDeclaredField("locals"));
-            PRIMITIVELOCALS_FIELD = runtime.lookupJavaField(FrameWithoutBoxing.class.getDeclaredField("primitiveLocals"));
-            TAGS_FIELD = runtime.lookupJavaField(FrameWithoutBoxing.class.getDeclaredField("tags"));
-        } catch (NoSuchFieldException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
     @SuppressWarnings("unused")
     @MethodSubstitution(isStatic = false, forced = true)
     public static Object pack(FrameWithoutBoxing frame) {
         return null;
     }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static Object getObject(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Object);
-        return getObjectUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setObject(FrameWithoutBoxing frame, FrameSlot slot, Object value) {
-        verifySet(frame, slot, FrameSlotKind.Object);
-        setObjectUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean getBoolean(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Boolean);
-        return getBooleanUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setBoolean(FrameWithoutBoxing frame, FrameSlot slot, boolean value) {
-        verifySet(frame, slot, FrameSlotKind.Boolean);
-        setBooleanUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static byte getByte(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Byte);
-        return getByteUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setByte(FrameWithoutBoxing frame, FrameSlot slot, byte value) {
-        verifySet(frame, slot, FrameSlotKind.Byte);
-        setByteUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static float getFloat(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Float);
-        return getFloatUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setFloat(FrameWithoutBoxing frame, FrameSlot slot, float value) {
-        verifySet(frame, slot, FrameSlotKind.Float);
-        setFloatUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static long getLong(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Long);
-        return getLongUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setLong(FrameWithoutBoxing frame, FrameSlot slot, long value) {
-        verifySet(frame, slot, FrameSlotKind.Long);
-        setLongUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static int getInt(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Int);
-        return getIntUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setInt(FrameWithoutBoxing frame, FrameSlot slot, int value) {
-        verifySet(frame, slot, FrameSlotKind.Int);
-        setIntUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static double getDouble(FrameWithoutBoxing frame, FrameSlot slot) {
-        verifyGet(frame, slot, FrameSlotKind.Double);
-        return getDoubleUnsafe(frame, slot);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static void setDouble(FrameWithoutBoxing frame, FrameSlot slot, double value) {
-        verifySet(frame, slot, FrameSlotKind.Double);
-        setDoubleUnsafe(frame, slot, value);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static Object getObjectUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Object, frame, slot, LOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setObjectUnsafe(FrameWithoutBoxing frame, FrameSlot slot, Object value) {
-        FrameSetNode.set(Kind.Object, frame, slot, value, LOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static boolean getBooleanUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Boolean, frame, slot, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setBooleanUnsafe(FrameWithoutBoxing frame, FrameSlot slot, boolean value) {
-        FrameSetNode.set(Kind.Boolean, frame, slot, value, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static byte getByteUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Byte, frame, slot, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setByteUnsafe(FrameWithoutBoxing frame, FrameSlot slot, byte value) {
-        FrameSetNode.set(Kind.Byte, frame, slot, value, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static int getIntUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Int, frame, slot, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setIntUnsafe(FrameWithoutBoxing frame, FrameSlot slot, int value) {
-        FrameSetNode.set(Kind.Int, frame, slot, value, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static long getLongUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Long, frame, slot, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setLongUnsafe(FrameWithoutBoxing frame, FrameSlot slot, long value) {
-        FrameSetNode.set(Kind.Long, frame, slot, value, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static double getDoubleUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Double, frame, slot, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setDoubleUnsafe(FrameWithoutBoxing frame, FrameSlot slot, double value) {
-        FrameSetNode.set(Kind.Double, frame, slot, value, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static float getFloatUnsafe(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Float, frame, slot, PRIMITIVELOCALS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false)
-    public static void setFloatUnsafe(FrameWithoutBoxing frame, FrameSlot slot, float value) {
-        FrameSetNode.set(Kind.Float, frame, slot, value, PRIMITIVELOCALS_FIELD);
-    }
-
-    private static void verifySet(FrameWithoutBoxing frame, FrameSlot slot, FrameSlotKind accessType) {
-        setTag(frame, slot, (byte) accessType.ordinal());
-    }
-
-    private static void verifyGet(FrameWithoutBoxing frame, FrameSlot slot, FrameSlotKind accessType) {
-        byte tag = getTag(frame, slot);
-        if (accessType == FrameSlotKind.Object ? (tag & 0xfe) != 0 : tag != (byte) accessType.ordinal()) {
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.UnreachedCode);
-        }
-    }
-
-    private static byte getTag(FrameWithoutBoxing frame, FrameSlot slot) {
-        return FrameGetNode.get(Kind.Byte, frame, slot, TAGS_FIELD);
-    }
-
-    private static void setTag(FrameWithoutBoxing frame, FrameSlot slot, byte tag) {
-        FrameSetNode.set(Kind.Byte, frame, slot, tag, TAGS_FIELD);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static MaterializedFrame materialize(FrameWithoutBoxing frame) {
-        return MaterializeFrameNode.materialize(frame);
-    }
-
-    @MethodSubstitution(isStatic = false, forced = true)
-    public static boolean isInitialized(FrameWithoutBoxing frame, FrameSlot slot) {
-        return getTag(frame, slot) != 0;
-    }
 }
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java	Tue Oct 15 02:07:33 2013 +0200
@@ -115,14 +115,11 @@
         Object execute(VirtualFrame frame) {
             Object o = value.execute(frame);
             if (o instanceof Integer) {
-                try {
-                    frame.setInt(slot, (Integer) o);
-                } catch (FrameSlotTypeException e) {
-                    // fall through
-                }
+                frame.setInt(slot, (Integer) o);
+            } else {
+                frame.setObject(slot, o);
+                this.replace(new ObjectAssignLocal(slot, value));
             }
-            frame.setObject(slot, o);
-            this.replace(new ObjectAssignLocal(slot, value));
             return null;
         }
     }
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Tue Oct 15 02:07:33 2013 +0200
@@ -114,11 +114,7 @@
 
         @Override
         int execute(VirtualFrame frame) {
-            try {
-                frame.setInt(slot, 42);
-            } catch (FrameSlotTypeException e) {
-                throw new IllegalStateException(e);
-            }
+            frame.setInt(slot, 42);
             return 0;
         }
     }
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java	Tue Oct 15 02:07:33 2013 +0200
@@ -122,12 +122,7 @@
         Object execute(VirtualFrame frame) {
             try {
                 int result = value.executeInt(frame);
-                try {
-                    frame.setInt(slot, result);
-                } catch (FrameSlotTypeException e) {
-                    frame.setObject(slot, result);
-                    replace(new ObjectAssignLocal(slot, value));
-                }
+                frame.setInt(slot, result);
             } catch (UnexpectedResultException e) {
                 frame.setObject(slot, e.getResult());
                 replace(new ObjectAssignLocal(slot, value));
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Tue Oct 15 02:07:33 2013 +0200
@@ -28,6 +28,8 @@
 import java.lang.reflect.*;
 import java.util.concurrent.*;
 
+import com.oracle.truffle.api.frame.*;
+
 import sun.misc.*;
 
 /**
@@ -165,6 +167,20 @@
     }
 
     /**
+     * Asserts that this value is not null and retrieved from a call to Frame.materialize.
+     * 
+     * @param value the value that is known to have been obtained via Frame.materialize
+     * @return the value to be casted to the new type
+     */
+    public static MaterializedFrame unsafeFrameCast(MaterializedFrame value) {
+        return unsafeCast(value, getUnsafeFrameType(), true);
+    }
+
+    private static Class<? extends MaterializedFrame> getUnsafeFrameType() {
+        return MaterializedFrame.class;
+    }
+
+    /**
      * Unsafe access to a boolean value within an object. The condition parameter gives a hint to
      * the compiler under which circumstances this access can be moved to an earlier location in the
      * program. The location identity gives a hint to the compiler for improved global value
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Tue Oct 15 02:07:33 2013 +0200
@@ -70,6 +70,7 @@
      * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
+     * @throws FrameSlotTypeException
      */
     byte getByte(FrameSlot slot) throws FrameSlotTypeException;
 
@@ -80,7 +81,7 @@
      * @param value the new value of the local variable
      */
 
-    void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException;
+    void setByte(FrameSlot slot, byte value);
 
     /**
      * Read access to a local variable of type boolean.
@@ -96,7 +97,7 @@
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
-    void setBoolean(FrameSlot slot, boolean value) throws FrameSlotTypeException;
+    void setBoolean(FrameSlot slot, boolean value);
 
     /**
      * Read access to a local variable of type int.
@@ -112,7 +113,7 @@
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
-    void setInt(FrameSlot slot, int value) throws FrameSlotTypeException;
+    void setInt(FrameSlot slot, int value);
 
     /**
      * Read access to a local variable of type long.
@@ -128,7 +129,7 @@
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
-    void setLong(FrameSlot slot, long value) throws FrameSlotTypeException;
+    void setLong(FrameSlot slot, long value);
 
     /**
      * Read access to a local variable of type float.
@@ -144,7 +145,7 @@
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
-    void setFloat(FrameSlot slot, float value) throws FrameSlotTypeException;
+    void setFloat(FrameSlot slot, float value);
 
     /**
      * Read access to a local variable of type double.
@@ -160,7 +161,7 @@
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
-    void setDouble(FrameSlot slot, double value) throws FrameSlotTypeException;
+    void setDouble(FrameSlot slot, double value);
 
     /**
      * Read access to a local variable of any type.
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotImpl.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotImpl.java	Tue Oct 15 02:07:33 2013 +0200
@@ -29,7 +29,7 @@
     private final FrameDescriptor descriptor;
     private final Object identifier;
     private final int index;
-    private FrameSlotKind kind;
+    @com.oracle.truffle.api.CompilerDirectives.CompilationFinal private FrameSlotKind kind;
 
     public FrameSlotImpl(FrameDescriptor descriptor, Object identifier, int index, FrameSlotKind kind) {
         this.descriptor = descriptor;
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotKind.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotKind.java	Tue Oct 15 02:07:33 2013 +0200
@@ -25,5 +25,5 @@
 package com.oracle.truffle.api.frame;
 
 public enum FrameSlotKind {
-    Illegal, Object, Long, Int, Double, Float, Boolean, Byte;
+    Object, Illegal, Long, Int, Double, Float, Boolean, Byte;
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java	Tue Oct 15 02:07:33 2013 +0200
@@ -47,14 +47,7 @@
      * @param value the new value of the local variable
      */
     public static void setByteSafe(Frame frame, FrameSlot slot, byte value) {
-        if (slot.getKind() != FrameSlotKind.Byte) {
-            slot.setKind(FrameSlotKind.Byte);
-        }
-        try {
-            frame.setByte(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException();
-        }
+        frame.setByte(slot, value);
     }
 
     /**
@@ -66,14 +59,7 @@
      * @param value the new value of the local variable
      */
     public static void setBooleanSafe(Frame frame, FrameSlot slot, boolean value) {
-        if (slot.getKind() != FrameSlotKind.Boolean) {
-            slot.setKind(FrameSlotKind.Boolean);
-        }
-        try {
-            frame.setBoolean(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException();
-        }
+        frame.setBoolean(slot, value);
     }
 
     /**
@@ -85,14 +71,7 @@
      * @param value the new value of the local variable
      */
     public static void setIntSafe(Frame frame, FrameSlot slot, int value) {
-        if (slot.getKind() != FrameSlotKind.Int) {
-            slot.setKind(FrameSlotKind.Int);
-        }
-        try {
-            frame.setInt(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException();
-        }
+        frame.setInt(slot, value);
     }
 
     /**
@@ -104,14 +83,7 @@
      * @param value the new value of the local variable
      */
     public static void setLongSafe(Frame frame, FrameSlot slot, long value) {
-        if (slot.getKind() != FrameSlotKind.Long) {
-            slot.setKind(FrameSlotKind.Long);
-        }
-        try {
-            frame.setLong(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException();
-        }
+        frame.setLong(slot, value);
     }
 
     /**
@@ -123,14 +95,7 @@
      * @param value the new value of the local variable
      */
     public static void setFloatSafe(Frame frame, FrameSlot slot, float value) {
-        if (slot.getKind() != FrameSlotKind.Float) {
-            slot.setKind(FrameSlotKind.Float);
-        }
-        try {
-            frame.setFloat(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException();
-        }
+        frame.setFloat(slot, value);
     }
 
     /**
@@ -142,13 +107,6 @@
      * @param value the new value of the local variable
      */
     public static void setDoubleSafe(Frame frame, FrameSlot slot, double value) {
-        if (slot.getKind() != FrameSlotKind.Double) {
-            slot.setKind(FrameSlotKind.Double);
-        }
-        try {
-            frame.setDouble(slot, value);
-        } catch (FrameSlotTypeException e) {
-            throw new IllegalStateException();
-        }
+        frame.setDouble(slot, value);
     }
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultFrameTypeConversion.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultFrameTypeConversion.java	Tue Oct 15 02:07:33 2013 +0200
@@ -40,6 +40,9 @@
 
     @Override
     public void updateFrameSlot(Frame frame, FrameSlot slot, Object value) {
+        if (slot.getKind() != FrameSlotKind.Object) {
+            slot.setKind(FrameSlotKind.Object);
+        }
         frame.setObject(slot, value);
     }
 
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java	Tue Oct 15 02:07:33 2013 +0200
@@ -56,7 +56,7 @@
     }
 
     @Override
-    public void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException {
+    public void setByte(FrameSlot slot, byte value) {
         wrapped.setByte(slot, value);
     }
 
@@ -66,7 +66,7 @@
     }
 
     @Override
-    public void setBoolean(FrameSlot slot, boolean value) throws FrameSlotTypeException {
+    public void setBoolean(FrameSlot slot, boolean value) {
         wrapped.setBoolean(slot, value);
     }
 
@@ -76,7 +76,7 @@
     }
 
     @Override
-    public void setInt(FrameSlot slot, int value) throws FrameSlotTypeException {
+    public void setInt(FrameSlot slot, int value) {
         wrapped.setInt(slot, value);
     }
 
@@ -86,7 +86,7 @@
     }
 
     @Override
-    public void setLong(FrameSlot slot, long value) throws FrameSlotTypeException {
+    public void setLong(FrameSlot slot, long value) {
         wrapped.setLong(slot, value);
     }
 
@@ -96,7 +96,7 @@
     }
 
     @Override
-    public void setFloat(FrameSlot slot, float value) throws FrameSlotTypeException {
+    public void setFloat(FrameSlot slot, float value) {
         wrapped.setFloat(slot, value);
     }
 
@@ -106,7 +106,7 @@
     }
 
     @Override
-    public void setDouble(FrameSlot slot, double value) throws FrameSlotTypeException {
+    public void setDouble(FrameSlot slot, double value) {
         wrapped.setDouble(slot, value);
     }
 
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java	Tue Oct 15 02:07:33 2013 +0200
@@ -75,7 +75,7 @@
 
     @Override
     public void setObject(FrameSlot slot, Object value) {
-        verifySetObject(slot);
+        verifySet(slot, FrameSlotKind.Object);
         locals[slot.getIndex()] = value;
     }
 
@@ -86,7 +86,7 @@
     }
 
     @Override
-    public void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException {
+    public void setByte(FrameSlot slot, byte value) {
         verifySet(slot, FrameSlotKind.Byte);
         locals[slot.getIndex()] = value;
     }
@@ -98,7 +98,7 @@
     }
 
     @Override
-    public void setBoolean(FrameSlot slot, boolean value) throws FrameSlotTypeException {
+    public void setBoolean(FrameSlot slot, boolean value) {
         verifySet(slot, FrameSlotKind.Boolean);
         locals[slot.getIndex()] = value;
     }
@@ -110,7 +110,7 @@
     }
 
     @Override
-    public void setInt(FrameSlot slot, int value) throws FrameSlotTypeException {
+    public void setInt(FrameSlot slot, int value) {
         verifySet(slot, FrameSlotKind.Int);
         locals[slot.getIndex()] = value;
     }
@@ -122,7 +122,7 @@
     }
 
     @Override
-    public void setLong(FrameSlot slot, long value) throws FrameSlotTypeException {
+    public void setLong(FrameSlot slot, long value) {
         verifySet(slot, FrameSlotKind.Long);
         locals[slot.getIndex()] = value;
     }
@@ -134,7 +134,7 @@
     }
 
     @Override
-    public void setFloat(FrameSlot slot, float value) throws FrameSlotTypeException {
+    public void setFloat(FrameSlot slot, float value) {
         verifySet(slot, FrameSlotKind.Float);
         locals[slot.getIndex()] = value;
     }
@@ -146,7 +146,7 @@
     }
 
     @Override
-    public void setDouble(FrameSlot slot, double value) throws FrameSlotTypeException {
+    public void setDouble(FrameSlot slot, double value) {
         verifySet(slot, FrameSlotKind.Double);
         locals[slot.getIndex()] = value;
     }
@@ -165,15 +165,7 @@
         return locals[slotIndex];
     }
 
-    private void verifySet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException {
-        FrameSlotKind slotKind = slot.getKind();
-        if (slotKind != accessKind) {
-            if (slotKind == FrameSlotKind.Illegal) {
-                slot.setKind(accessKind);
-            } else {
-                throw new FrameSlotTypeException();
-            }
-        }
+    private void verifySet(FrameSlot slot, FrameSlotKind accessKind) {
         int slotIndex = slot.getIndex();
         if (slotIndex >= tags.length) {
             resize();
@@ -181,24 +173,13 @@
         tags[slotIndex] = (byte) accessKind.ordinal();
     }
 
-    private void verifySetObject(FrameSlot slot) {
-        if (slot.getKind() != FrameSlotKind.Object) {
-            slot.setKind(FrameSlotKind.Object);
-        }
-        int slotIndex = slot.getIndex();
-        if (slotIndex >= tags.length) {
-            resize();
-        }
-        tags[slotIndex] = (byte) FrameSlotKind.Object.ordinal();
-    }
-
     private void verifyGet(FrameSlot slot, FrameSlotKind accessKind) throws FrameSlotTypeException {
         int slotIndex = slot.getIndex();
         if (slotIndex >= tags.length) {
             resize();
         }
         byte tag = tags[slotIndex];
-        if (accessKind == FrameSlotKind.Object ? (tag & 0xfe) != 0 : tag != accessKind.ordinal()) {
+        if (accessKind == FrameSlotKind.Object ? tag != 0 : tag != accessKind.ordinal()) {
             if (slot.getKind() == accessKind || tag == 0) {
                 descriptor.getTypeConversion().updateFrameSlot(this, slot, getValue(slot));
                 if (tags[slotIndex] == accessKind.ordinal()) {
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WriteLocalNode.java	Tue Oct 15 01:50:48 2013 +0200
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WriteLocalNode.java	Tue Oct 15 02:07:33 2013 +0200
@@ -36,14 +36,14 @@
         this(node.slot);
     }
 
-    @Specialization(rewriteOn = FrameSlotTypeException.class)
-    public int write(VirtualFrame frame, int right) throws FrameSlotTypeException {
+    @Specialization
+    public int write(VirtualFrame frame, int right) {
         frame.setInt(slot, right);
         return right;
     }
 
-    @Specialization(rewriteOn = FrameSlotTypeException.class)
-    public boolean write(VirtualFrame frame, boolean right) throws FrameSlotTypeException {
+    @Specialization
+    public boolean write(VirtualFrame frame, boolean right) {
         frame.setBoolean(slot, right);
         return right;
     }
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Tue Oct 15 01:50:48 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Tue Oct 15 02:07:33 2013 +0200
@@ -1132,6 +1132,7 @@
     VM_Deoptimize op;
     VMThread::execute(&op);
   }
+  HotSpotInstalledCode::set_codeBlob(hotspotInstalledCode, 0);
 C2V_END