# HG changeset patch # User Gilles Duboscq # Date 1406907454 -7200 # Node ID 9a8f4c9e11a8f148ef3bbedb545f2f165fa19814 # Parent f2cd7b3d5aefc539fab9c7f3367dea356cfa924b Truffle: Add conditions to CompilerDirective accesses in FrameWithoutBoxing diff -r f2cd7b3d5aef -r 9a8f4c9e11a8 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java Fri Aug 01 15:19:26 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java Fri Aug 01 17:37:34 2014 +0200 @@ -81,7 +81,9 @@ } private Object getObjectUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetObject(getLocals(), (long) slot.getIndex() * Unsafe.ARRAY_OBJECT_INDEX_SCALE + Unsafe.ARRAY_OBJECT_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetObject(getLocals(), (long) slotIndex * Unsafe.ARRAY_OBJECT_INDEX_SCALE + Unsafe.ARRAY_OBJECT_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Object.ordinal(), slot); } @Override @@ -101,7 +103,9 @@ } private byte getByteUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetByte(getPrimitiveLocals(), (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetByte(getPrimitiveLocals(), (long) slotIndex * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Byte.ordinal(), slot); } @Override @@ -121,7 +125,9 @@ } private boolean getBooleanUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetBoolean(getPrimitiveLocals(), (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetBoolean(getPrimitiveLocals(), (long) slotIndex * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Boolean.ordinal(), slot); } @Override @@ -141,7 +147,9 @@ } private float getFloatUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetFloat(getPrimitiveLocals(), (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetFloat(getPrimitiveLocals(), (long) slotIndex * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Float.ordinal(), slot); } @Override @@ -161,7 +169,9 @@ } private long getLongUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetLong(getPrimitiveLocals(), (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetLong(getPrimitiveLocals(), (long) slotIndex * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Long.ordinal(), slot); } @Override @@ -181,7 +191,9 @@ } private int getIntUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetInt(getPrimitiveLocals(), (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetInt(getPrimitiveLocals(), (long) slotIndex * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Int.ordinal(), slot); } @Override @@ -201,7 +213,9 @@ } private double getDoubleUnsafe(FrameSlot slot) { - return CompilerDirectives.unsafeGetDouble(getPrimitiveLocals(), (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, true, slot); + int slotIndex = slot.getIndex(); + return CompilerDirectives.unsafeGetDouble(getPrimitiveLocals(), (long) slotIndex * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, + this.getTags()[slotIndex] == FrameSlotKind.Double.ordinal(), slot); } @Override