# HG changeset patch # User Lukas Stadler # Date 1360316469 -3600 # Node ID ebba355f5605e6448001ce342dd1b24cdc1ceff1 # Parent 43201885d40009cb0005d0b8805d82a93e3be9dc explicitly specify type in DirectStoreNode.store diff -r 43201885d400 -r ebba355f5605 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java --- 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); } } } diff -r 43201885d400 -r ebba355f5605 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java --- 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) diff -r 43201885d400 -r ebba355f5605 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java --- 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); }