changeset 7763:ebba355f5605

explicitly specify type in DirectStoreNode.store
author Lukas Stadler <lukas.stadler@jku.at>
date Fri, 08 Feb 2013 10:41:09 +0100
parents 43201885d400
children cff55cdeea48
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java
diffstat 3 files changed, 42 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Fri Feb 08 10:31:54 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Fri Feb 08 10:41:09 2013 +0100
@@ -256,7 +256,7 @@
             long end = (dstAddr + header + ((long) destPos + length - 1) * scale) >>> cardShift;
             long count = end - start + 1;
             while (count-- > 0) {
-                DirectStoreNode.store((start + cardStart) + count, false);
+                DirectStoreNode.store((start + cardStart) + count, false, Kind.Boolean);
             }
         }
     }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java	Fri Feb 08 10:31:54 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java	Fri Feb 08 10:41:09 2013 +0100
@@ -313,37 +313,37 @@
 
     @MethodSubstitution(isStatic = false)
     public static void putByte(@SuppressWarnings("unused") final Object thisObj, long address, byte value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Byte);
     }
 
     @MethodSubstitution(isStatic = false)
     public static void putShort(@SuppressWarnings("unused") final Object thisObj, long address, short value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Short);
     }
 
     @MethodSubstitution(isStatic = false)
     public static void putChar(@SuppressWarnings("unused") final Object thisObj, long address, char value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Char);
     }
 
     @MethodSubstitution(isStatic = false)
     public static void putInt(@SuppressWarnings("unused") final Object thisObj, long address, int value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Int);
     }
 
     @MethodSubstitution(isStatic = false)
     public static void putLong(@SuppressWarnings("unused") final Object thisObj, long address, long value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Long);
     }
 
     @MethodSubstitution(isStatic = false)
     public static void putFloat(@SuppressWarnings("unused") final Object thisObj, long address, float value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Float);
     }
 
     @MethodSubstitution(isStatic = false)
     public static void putDouble(@SuppressWarnings("unused") final Object thisObj, long address, double value) {
-        DirectStoreNode.store(address, value);
+        DirectStoreNode.store(address, value, Kind.Double);
     }
 
     @MethodSubstitution(isStatic = false)
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java	Fri Feb 08 10:31:54 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java	Fri Feb 08 10:41:09 2013 +0100
@@ -37,40 +37,48 @@
 
     @Input private ValueNode address;
     @Input private ValueNode value;
+    private final Kind kind;
 
-    public DirectStoreNode(ValueNode address, ValueNode value) {
+    public DirectStoreNode(ValueNode address, ValueNode value, Kind kind) {
         super(StampFactory.forVoid());
         this.address = address;
         this.value = value;
+        this.kind = kind;
     }
 
-    @NodeIntrinsic
-    public static native void store(long address, boolean value);
-
-    @NodeIntrinsic
-    public static native void store(long address, byte value);
-
-    @NodeIntrinsic
-    public static native void store(long address, short value);
-
-    @NodeIntrinsic
-    public static native void store(long address, char value);
-
-    @NodeIntrinsic
-    public static native void store(long address, int value);
-
-    @NodeIntrinsic
-    public static native void store(long address, long value);
-
-    @NodeIntrinsic
-    public static native void store(long address, float value);
-
-    @NodeIntrinsic
-    public static native void store(long address, double value);
-
     @Override
     public void generate(LIRGeneratorTool gen) {
         Value v = gen.operand(value);
-        gen.emitStore(new Address(v.getKind(), gen.operand(address)), v, false);
+        gen.emitStore(new Address(kind, gen.operand(address)), v, false);
     }
+
+    /*
+     * The kind of the store is provided explicitly in these intrinsics because it is not always
+     * possible to determine the kind from the given value during compilation (because stack kinds
+     * are used).
+     */
+
+    @NodeIntrinsic
+    public static native void store(long address, boolean value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, byte value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, short value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, char value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, int value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, long value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, float value, @ConstantNodeParameter Kind kind);
+
+    @NodeIntrinsic
+    public static native void store(long address, double value, @ConstantNodeParameter Kind kind);
 }