# HG changeset patch # User Doug Simon # Date 1333443400 -7200 # Node ID 9b8c0d1bc2dd6e2faf66fcebc1b4b56821e10a6b # Parent b00e56aa159db06ad2d9e66f566510160383e72b unsafe load/store snippets now require a displacement argument which allows x86 complex addressing modes to be used for tighter encoding of array store/load operations replaced ArrayHeaderSizeNode with an arrayHeaderSizeFor(CiKind elementKind) method annotated by @Fold diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java Tue Apr 03 10:56:40 2012 +0200 @@ -575,11 +575,13 @@ Variable newValue = load(operand(node.newValue())); CiAddress address; + int displacement = node.displacement(); CiValue index = operand(node.offset()); if (isConstant(index) && NumUtil.isInt(asConstant(index).asLong())) { - address = new CiAddress(kind, load(operand(node.object())), (int) asConstant(index).asLong()); + displacement += (int) asConstant(index).asLong(); + address = new CiAddress(kind, load(operand(node.object())), displacement); } else { - address = new CiAddress(kind, load(operand(node.object())), load(index), CiAddress.Scale.Times1, 0); + address = new CiAddress(kind, load(operand(node.object())), load(index), CiAddress.Scale.Times1, displacement); } CiRegisterValue rax = AMD64.rax.asValue(kind); diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Tue Apr 03 10:56:40 2012 +0200 @@ -41,7 +41,6 @@ import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.type.*; -import com.oracle.graal.snippets.nodes.*; import com.oracle.max.cri.ci.*; import com.oracle.max.cri.ci.CiTargetMethod.Call; import com.oracle.max.cri.ci.CiTargetMethod.DataPatch; @@ -268,7 +267,7 @@ graph.addAfterFixed(cas, writeBarrier); } else { // This may be an array store so use an array write barrier - LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, cas.expected().kind(), 0, cas.offset(), graph, false); + LocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, false); graph.addAfterFixed(cas, graph.add(new ArrayWriteBarrier(cas.object(), location))); } } @@ -338,9 +337,6 @@ write.setStateAfter(store.stateAfter()); graph.replaceFixedWithFixed(store, write); graph.addBeforeFixed(write, barrier); - } else if (n instanceof ArrayHeaderSizeNode) { - ArrayHeaderSizeNode arrayHeaderSize = (ArrayHeaderSizeNode) n; - graph.replaceFloating(arrayHeaderSize, ConstantNode.forLong(config.getArrayOffset(arrayHeaderSize.elementKind()), n.graph())); } else if (n instanceof ReadHubNode) { ReadHubNode objectClassNode = (ReadHubNode) n; LocationNode location = LocationNode.create(LocationNode.FINAL_LOCATION, CiKind.Object, config.hubOffset, graph); diff -r b00e56aa159d -r 9b8c0d1bc2dd 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 Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Tue Apr 03 10:56:40 2012 +0200 @@ -21,16 +21,15 @@ * questions. */ package com.oracle.graal.hotspot.snippets; -import com.oracle.max.cri.ci.*; import com.oracle.graal.cri.*; -import com.oracle.graal.graph.Node.Fold; +import com.oracle.graal.graph.Node.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.snippets.*; -import com.oracle.graal.snippets.nodes.*; +import com.oracle.max.cri.ci.*; public class ArrayCopySnippets implements SnippetsInterface{ @@ -228,7 +227,7 @@ copyObjectsUp(src, srcPos * 8L, dest, destPos * 8L, length); } if (length > 0) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object); + int header = arrayHeaderSizeFor(CiKind.Object); int cardShift = cardTableShift(); long cardStart = cardTableStart(); long dstAddr = GetObjectAddressNode.get(dest); @@ -243,47 +242,47 @@ @Snippet public static void copyBytesDown(Object src, int srcPos, Object dest, int destPos, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Byte); + int header = arrayHeaderSizeFor(CiKind.Byte); for (long i = length - 1; i >= 0; i--) { - Byte a = UnsafeLoadNode.load(src, i + (srcPos + header), CiKind.Byte); - UnsafeStoreNode.store(dest, i + (destPos + header), a.byteValue(), CiKind.Byte); + Byte a = UnsafeLoadNode.load(src, header, i + srcPos, CiKind.Byte); + UnsafeStoreNode.store(dest, header, i + destPos, a.byteValue(), CiKind.Byte); } } @Snippet public static void copyShortsDown(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short); + int header = arrayHeaderSizeFor(CiKind.Short); for (long i = (length - 1) * 2; i >= 0; i -= 2) { - Character a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Short); - UnsafeStoreNode.store(dest, i + (destOffset + header), a.charValue(), CiKind.Short); + Character a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Short); + UnsafeStoreNode.store(dest, header, i + destOffset, a.charValue(), CiKind.Short); } } @Snippet public static void copyIntsDown(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Int); + int header = arrayHeaderSizeFor(CiKind.Int); for (long i = (length - 1) * 4; i >= 0; i -= 4) { - Integer a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Int); - UnsafeStoreNode.store(dest, i + (destOffset + header), a.intValue(), CiKind.Int); + Integer a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Int); + UnsafeStoreNode.store(dest, header, i + destOffset, a.intValue(), CiKind.Int); } } @Snippet public static void copyLongsDown(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Long); + int header = arrayHeaderSizeFor(CiKind.Long); for (long i = (length - 1) * 8; i >= 0; i -= 8) { - Long a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Long); - UnsafeStoreNode.store(dest, i + (destOffset + header), a.longValue(), CiKind.Long); + Long a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Long); + UnsafeStoreNode.store(dest, header, i + destOffset, a.longValue(), CiKind.Long); } } // Does NOT perform store checks @Snippet public static void copyObjectsDown(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object); + int header = arrayHeaderSizeFor(CiKind.Object); for (long i = (length - 1) * 8; i >= 0; i -= 8) { - Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object); - DirectObjectStoreNode.store(dest, i + (destOffset + header), a); + Object a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Object); + DirectObjectStoreNode.store(dest, header, i + destOffset, a); } } /** @@ -296,10 +295,10 @@ */ @Snippet public static void copyBytesUp(Object src, int srcPos, Object dest, int destPos, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Byte); + int header = arrayHeaderSizeFor(CiKind.Byte); for (long i = 0; i < length; i++) { - Byte a = UnsafeLoadNode.load(src, i + (srcPos + header), CiKind.Byte); - UnsafeStoreNode.store(dest, i + (destPos + header), a.byteValue(), CiKind.Byte); + Byte a = UnsafeLoadNode.load(src, header, i + srcPos, CiKind.Byte); + UnsafeStoreNode.store(dest, header, i + destPos, a.byteValue(), CiKind.Byte); } } @@ -313,38 +312,38 @@ */ @Snippet public static void copyShortsUp(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Short); + int header = arrayHeaderSizeFor(CiKind.Short); for (long i = 0; i < length * 2L; i += 2) { - Character a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Short); - UnsafeStoreNode.store(dest, i + (destOffset + header), a.charValue(), CiKind.Short); + Character a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Short); + UnsafeStoreNode.store(dest, header, i + destOffset, a.charValue(), CiKind.Short); } } @Snippet public static void copyIntsUp(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Int); + int header = arrayHeaderSizeFor(CiKind.Int); for (long i = 0; i < length * 4L; i += 4) { - Integer a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Int); - UnsafeStoreNode.store(dest, i + (destOffset + header), a.intValue(), CiKind.Int); + Integer a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Int); + UnsafeStoreNode.store(dest, header, i + destOffset, a.intValue(), CiKind.Int); } } @Snippet public static void copyLongsUp(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Long); + int header = arrayHeaderSizeFor(CiKind.Long); for (long i = 0; i < length * 8L; i += 8) { - Long a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Long); - UnsafeStoreNode.store(dest, i + (destOffset + header), a.longValue(), CiKind.Long); + Long a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Long); + UnsafeStoreNode.store(dest, header, i + destOffset, a.longValue(), CiKind.Long); } } // Does NOT perform store checks @Snippet public static void copyObjectsUp(Object src, long srcOffset, Object dest, long destOffset, int length) { - long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object); + int header = arrayHeaderSizeFor(CiKind.Object); for (long i = 0; i < length * 8L; i += 8) { - Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object); - DirectObjectStoreNode.store(dest, i + (destOffset + header), a); + Object a = UnsafeLoadNode.load(src, header, i + srcOffset, CiKind.Object); + DirectObjectStoreNode.store(dest, header, i + destOffset, a); } } private static class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable { @@ -401,42 +400,37 @@ @Input private ValueNode object; @Input private ValueNode value; @Input private ValueNode offset; + @Data private final int displacement; - public DirectObjectStoreNode(ValueNode object, ValueNode offset, ValueNode value) { + public DirectObjectStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value) { super(StampFactory.illegal()); this.object = object; this.value = value; this.offset = offset; + this.displacement = displacement; } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object obj, long offset, long value) { - throw new UnsupportedOperationException(); - } - - @SuppressWarnings("unused") - @NodeIntrinsic - public static void store(Object obj, long offset, boolean value) { - throw new UnsupportedOperationException(); - } - - @SuppressWarnings("unused") - @NodeIntrinsic - public static void store(Object obj, long offset, Object value) { + public static void store(Object obj, @ConstantNodeParameter int displacement, long offset, Object value) { throw new UnsupportedOperationException(); } @Override public void lower(CiLoweringTool tool) { StructuredGraph graph = (StructuredGraph) this.graph(); - IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, value.kind(), 0, offset, graph, false); + IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, value.kind(), displacement, offset, graph, false); WriteNode write = graph.add(new WriteNode(object, value, location)); graph.replaceFixedWithFixed(this, write); } } @Fold + private static int arrayHeaderSizeFor(CiKind elementKind) { + return CompilerImpl.getInstance().getConfig().getArrayOffset(elementKind); + } + + @Fold private static int cardTableShift() { return CompilerImpl.getInstance().getConfig().cardtableShift; } diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsafeSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsafeSnippets.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsafeSnippets.java Tue Apr 03 10:56:40 2012 +0200 @@ -35,19 +35,19 @@ public class UnsafeSnippets implements SnippetsInterface { public boolean compareAndSwapObject(Object o, long offset, Object expected, Object x) { - return CompareAndSwapNode.compareAndSwap(o, offset, expected, x); + return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x); } public boolean compareAndSwapInt(Object o, long offset, int expected, int x) { - return CompareAndSwapNode.compareAndSwap(o, offset, expected, x); + return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x); } public boolean compareAndSwapLong(Object o, long offset, long expected, long x) { - return CompareAndSwapNode.compareAndSwap(o, offset, expected, x); + return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x); } public Object getObject(Object o, long offset) { - return UnsafeLoadNode.load(o, offset, CiKind.Object); + return UnsafeLoadNode.load(o, 0, offset, CiKind.Object); } public Object getObjectVolatile(Object o, long offset) { @@ -58,7 +58,7 @@ } public void putObject(Object o, long offset, Object x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Object); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Object); } public void putObjectVolatile(Object o, long offset, Object x) { @@ -68,7 +68,7 @@ } public int getInt(Object o, long offset) { - Integer value = UnsafeLoadNode.load(o, offset, CiKind.Int); + Integer value = UnsafeLoadNode.load(o, 0, offset, CiKind.Int); return value; } @@ -80,7 +80,7 @@ } public void putInt(Object o, long offset, int x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Int); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Int); } public void putIntVolatile(Object o, long offset, int x) { @@ -91,7 +91,7 @@ public boolean getBoolean(Object o, long offset) { @JavacBug(id = 6995200) - Boolean result = UnsafeLoadNode.load(o, offset, CiKind.Boolean); + Boolean result = UnsafeLoadNode.load(o, 0, offset, CiKind.Boolean); return result; } @@ -103,7 +103,7 @@ } public void putBoolean(Object o, long offset, boolean x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Boolean); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Boolean); } public void putBooleanVolatile(Object o, long offset, boolean x) { @@ -114,7 +114,7 @@ public byte getByte(Object o, long offset) { @JavacBug(id = 6995200) - Byte result = UnsafeLoadNode.load(o, offset, CiKind.Byte); + Byte result = UnsafeLoadNode.load(o, 0, offset, CiKind.Byte); return result; } @@ -126,7 +126,7 @@ } public void putByte(Object o, long offset, byte x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Byte); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Byte); } public void putByteVolatile(Object o, long offset, byte x) { @@ -137,7 +137,7 @@ public short getShort(Object o, long offset) { @JavacBug(id = 6995200) - Short result = UnsafeLoadNode.load(o, offset, CiKind.Short); + Short result = UnsafeLoadNode.load(o, 0, offset, CiKind.Short); return result; } @@ -149,7 +149,7 @@ } public void putShort(Object o, long offset, short x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Short); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Short); } public void putShortVolatile(Object o, long offset, short x) { @@ -160,7 +160,7 @@ public char getChar(Object o, long offset) { @JavacBug(id = 6995200) - Character result = UnsafeLoadNode.load(o, offset, CiKind.Char); + Character result = UnsafeLoadNode.load(o, 0, offset, CiKind.Char); return result; } @@ -172,7 +172,7 @@ } public void putChar(Object o, long offset, char x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Char); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Char); } public void putCharVolatile(Object o, long offset, char x) { @@ -183,7 +183,7 @@ public long getLong(Object o, long offset) { @JavacBug(id = 6995200) - Long result = UnsafeLoadNode.load(o, offset, CiKind.Long); + Long result = UnsafeLoadNode.load(o, 0, offset, CiKind.Long); return result; } @@ -195,7 +195,7 @@ } public void putLong(Object o, long offset, long x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Long); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Long); } public void putLongVolatile(Object o, long offset, long x) { @@ -206,7 +206,7 @@ public float getFloat(Object o, long offset) { @JavacBug(id = 6995200) - Float result = UnsafeLoadNode.load(o, offset, CiKind.Float); + Float result = UnsafeLoadNode.load(o, 0, offset, CiKind.Float); return result; } @@ -218,7 +218,7 @@ } public void putFloat(Object o, long offset, float x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Float); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Float); } public void putFloatVolatile(Object o, long offset, float x) { @@ -229,7 +229,7 @@ public double getDouble(Object o, long offset) { @JavacBug(id = 6995200) - Double result = UnsafeLoadNode.load(o, offset, CiKind.Double); + Double result = UnsafeLoadNode.load(o, 0, offset, CiKind.Double); return result; } @@ -241,7 +241,7 @@ } public void putDouble(Object o, long offset, double x) { - UnsafeStoreNode.store(o, offset, x, CiKind.Double); + UnsafeStoreNode.store(o, 0, offset, x, CiKind.Double); } public void putDoubleVolatile(Object o, long offset, double x) { diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Apr 03 10:56:40 2012 +0200 @@ -50,10 +50,6 @@ return offset; } - public UnsafeLoadNode(ValueNode object, ValueNode offset, CiKind kind) { - this(object, 0, offset, kind); - } - public UnsafeLoadNode(ValueNode object, int displacement, ValueNode offset, CiKind kind) { super(StampFactory.forKind(kind.stackKind())); this.object = object; @@ -73,7 +69,7 @@ @SuppressWarnings("unused") @NodeIntrinsic - public static T load(Object object, long offset, @ConstantNodeParameter CiKind kind) { + public static T load(Object object, @ConstantNodeParameter int displacement, long offset, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler"); } } diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Tue Apr 03 10:56:40 2012 +0200 @@ -22,11 +22,11 @@ */ package com.oracle.graal.nodes.extended; -import com.oracle.max.cri.ci.*; import com.oracle.graal.cri.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +import com.oracle.max.cri.ci.*; /** * Store of a value at a location specified as an offset relative to an object. @@ -39,10 +39,6 @@ @Data private final int displacement; @Data private final CiKind storeKind; - public UnsafeStoreNode(ValueNode object, ValueNode offset, ValueNode value, CiKind kind) { - this(object, 0, offset, value, kind); - } - public UnsafeStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value, CiKind kind) { super(StampFactory.illegal()); assert kind != CiKind.Void && kind != CiKind.Illegal; @@ -81,55 +77,56 @@ // specialized on value type until boxing/unboxing is sorted out in intrinsification @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, Object value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, Object value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, boolean value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, boolean value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, byte value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, byte value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, char value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, char value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, double value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, double value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, float value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, float value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, int value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, int value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, long value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, long value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static void store(Object object, long offset, short value, @ConstantNodeParameter CiKind kind) { + public static void store(Object object, @ConstantNodeParameter int displacement, long offset, short value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + } diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Apr 03 10:56:40 2012 +0200 @@ -22,12 +22,12 @@ */ package com.oracle.graal.nodes.java; -import com.oracle.max.cri.ci.*; import com.oracle.graal.cri.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +import com.oracle.max.cri.ci.*; /** * Represents an atomic compare-and-swap operation @@ -39,6 +39,7 @@ @Input private ValueNode offset; @Input private ValueNode expected; @Input private ValueNode newValue; + @Data private final int displacement; public ValueNode object() { return object; @@ -56,13 +57,18 @@ return newValue; } - public CompareAndSwapNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue) { + public int displacement() { + return displacement; + } + + public CompareAndSwapNode(ValueNode object, int displacement, ValueNode offset, ValueNode expected, ValueNode newValue) { super(StampFactory.forKind(CiKind.Boolean.stackKind())); assert expected.kind() == newValue.kind(); this.object = object; this.offset = offset; this.expected = expected; this.newValue = newValue; + this.displacement = displacement; } @Override @@ -78,19 +84,19 @@ // specialized on value type until boxing/unboxing is sorted out in intrinsification @SuppressWarnings("unused") @NodeIntrinsic - public static boolean compareAndSwap(Object object, long offset, Object expected, Object newValue) { + public static boolean compareAndSwap(Object object, @ConstantNodeParameter int displacement, long offset, Object expected, Object newValue) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static boolean compareAndSwap(Object object, long offset, long expected, long newValue) { + public static boolean compareAndSwap(Object object, @ConstantNodeParameter int displacement, long offset, long expected, long newValue) { throw new UnsupportedOperationException(); } @SuppressWarnings("unused") @NodeIntrinsic - public static boolean compareAndSwap(Object object, long offset, int expected, int newValue) { + public static boolean compareAndSwap(Object object, @ConstantNodeParameter int displacement, long offset, int expected, int newValue) { throw new UnsupportedOperationException(); } } diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSnippets.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSnippets.java Tue Apr 03 10:05:49 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSnippets.java Tue Apr 03 10:56:40 2012 +0200 @@ -35,19 +35,19 @@ private static Node getNode(Node node, long offset) { - return UnsafeCastNode.cast(UnsafeLoadNode.load(node, offset, CiKind.Object), Node.class); + return UnsafeCastNode.cast(UnsafeLoadNode.load(node, 0, offset, CiKind.Object), Node.class); } private static NodeList getNodeList(Node node, long offset) { - return UnsafeCastNode.cast(UnsafeLoadNode.load(node, offset, CiKind.Object), NodeList.class); + return UnsafeCastNode.cast(UnsafeLoadNode.load(node, 0, offset, CiKind.Object), NodeList.class); } private static void putNode(Node node, long offset, Node value) { - UnsafeStoreNode.store(node, offset, value, CiKind.Object); + UnsafeStoreNode.store(node, 0, offset, value, CiKind.Object); } private static void putNodeList(Node node, long offset, NodeList value) { - UnsafeStoreNode.store(node, offset, value, CiKind.Object); + UnsafeStoreNode.store(node, 0, offset, value, CiKind.Object); } } diff -r b00e56aa159d -r 9b8c0d1bc2dd graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ArrayHeaderSizeNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ArrayHeaderSizeNode.java Tue Apr 03 10:05:49 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011, 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.snippets.nodes; - -import com.oracle.max.cri.ci.*; -import com.oracle.graal.cri.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.type.*; - -public class ArrayHeaderSizeNode extends FloatingNode implements Lowerable { - @Data private final CiKind elementKind; - - public ArrayHeaderSizeNode(CiKind elementKind) { - super(StampFactory.forKind(CiKind.Long)); - this.elementKind = elementKind; - } - - @Override - public void lower(CiLoweringTool tool) { - tool.getRuntime().lower(this, tool); - } - - public CiKind elementKind() { - return elementKind; - } - - @SuppressWarnings("unused") - @NodeIntrinsic - public static long sizeFor(@ConstantNodeParameter CiKind kind) { - throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler"); - } -}