changeset 11436:3ceffcb771e5

Merge.
author Doug Simon <doug.simon@oracle.com>
date Tue, 27 Aug 2013 12:08:12 +0200
parents 016da8e6fbef (current diff) be97540098f5 (diff)
children 58b72cc17109
files
diffstat 8 files changed, 111 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/FrameWithoutBoxing.java	Tue Aug 27 12:08:12 2013 +0200
@@ -100,6 +100,26 @@
     }
 
     @Override
+    public byte getByte(FrameSlot slot) throws FrameSlotTypeException {
+        verifyGet(slot, FrameSlotKind.Byte);
+        return getByteUnsafe(slot);
+    }
+
+    private byte getByteUnsafe(FrameSlot slot) {
+        return unsafe.getByte(primitiveLocals, (long) slot.getIndex() * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
+    }
+
+    @Override
+    public void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException {
+        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);
+    }
+
+    @Override
     public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException {
         verifyGet(slot, FrameSlotKind.Boolean);
         return getBooleanUnsafe(slot);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/FrameWithoutBoxingSubstitutions.java	Tue Aug 27 12:08:12 2013 +0200
@@ -80,6 +80,18 @@
     }
 
     @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);
@@ -148,6 +160,16 @@
     }
 
     @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);
     }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Tue Aug 27 12:08:12 2013 +0200
@@ -67,6 +67,23 @@
     void setObject(FrameSlot slot, Object value) throws FrameSlotTypeException;
 
     /**
+     * Read access to a local variable of type byte.
+     * 
+     * @param slot the slot of the local variable
+     * @return the current value of the local variable
+     */
+    byte getByte(FrameSlot slot) throws FrameSlotTypeException;
+
+    /**
+     * Write access to a local variable of type byte.
+     * 
+     * @param slot the slot of the local variable
+     * @param value the new value of the local variable
+     */
+
+    void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException;
+
+    /**
      * Read access to a local variable of type boolean.
      * 
      * @param slot the slot of the local variable
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotKind.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotKind.java	Tue Aug 27 12:08:12 2013 +0200
@@ -25,5 +25,5 @@
 package com.oracle.truffle.api.frame;
 
 public enum FrameSlotKind {
-    Illegal, Object, Long, Int, Double, Float, Boolean;
+    Illegal, Object, Long, Int, Double, Float, Boolean, Byte;
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java	Tue Aug 27 12:08:12 2013 +0200
@@ -46,6 +46,25 @@
     }
 
     /**
+     * Write access to a local variable of type {@code byte}.
+     * 
+     * Sets the frame slot type to {@code byte} if it isn't already.
+     * 
+     * @param slot the slot of the local variable
+     * @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();
+        }
+    }
+
+    /**
      * Write access to a local variable of type {@code boolean}.
      * 
      * Sets the frame slot type to {@code boolean} if it isn't already.
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java	Tue Aug 27 12:08:12 2013 +0200
@@ -57,6 +57,16 @@
     }
 
     @Override
+    public byte getByte(FrameSlot slot) {
+        throw new UnsupportedOperationException("native frame");
+    }
+
+    @Override
+    public void setByte(FrameSlot slot, byte value) {
+        throw new UnsupportedOperationException("native frame");
+    }
+
+    @Override
     public boolean getBoolean(FrameSlot slot) {
         throw new UnsupportedOperationException("native frame");
     }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java	Tue Aug 27 12:08:12 2013 +0200
@@ -51,6 +51,16 @@
     }
 
     @Override
+    public byte getByte(FrameSlot slot) throws FrameSlotTypeException {
+        return wrapped.getByte(slot);
+    }
+
+    @Override
+    public void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException {
+        wrapped.setByte(slot, value);
+    }
+
+    @Override
     public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException {
         return wrapped.getBoolean(slot);
     }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java	Tue Aug 27 12:03:31 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java	Tue Aug 27 12:08:12 2013 +0200
@@ -79,6 +79,18 @@
     }
 
     @Override
+    public byte getByte(FrameSlot slot) throws FrameSlotTypeException {
+        verifyGet(slot, FrameSlotKind.Byte);
+        return (byte) locals[slot.getIndex()];
+    }
+
+    @Override
+    public void setByte(FrameSlot slot, byte value) throws FrameSlotTypeException {
+        verifySet(slot, FrameSlotKind.Byte);
+        locals[slot.getIndex()] = value;
+    }
+
+    @Override
     public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException {
         verifyGet(slot, FrameSlotKind.Boolean);
         return (boolean) locals[slot.getIndex()];