# HG changeset patch # User Gilles Duboscq # Date 1328206083 -3600 # Node ID c97f09b8d1ce2574321395434f4f5dd39f4db3dd # Parent 002673e4c67f4ad7c9844414c7bf3fd7c50e75c1 Fix off by one in array copy write barrier, since the bulk barrier works, remove the barrier from the copy loop diff -r 002673e4c67f -r c97f09b8d1ce graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java Wed Feb 01 23:44:16 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java Thu Feb 02 19:08:03 2012 +0100 @@ -25,6 +25,7 @@ import com.oracle.max.cri.ri.*; import com.oracle.max.graal.compiler.util.*; import com.oracle.max.graal.cri.*; +import com.oracle.max.graal.debug.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.nodes.*; @@ -58,6 +59,7 @@ intrinsicGraph = runtime.intrinsicGraph(invoke.stateAfter().method(), invoke.bci(), target, invoke.callTarget().arguments()); } if (intrinsicGraph != null) { + Debug.log(" > Intrinsify %s", target); InliningUtil.inline(invoke, intrinsicGraph, true); } } diff -r 002673e4c67f -r c97f09b8d1ce graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java Wed Feb 01 23:44:16 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java Thu Feb 02 19:08:03 2012 +0100 @@ -23,6 +23,7 @@ package com.oracle.max.graal.hotspot.snippets; import com.oracle.max.cri.ci.*; +import com.oracle.max.graal.cri.*; import com.oracle.max.graal.hotspot.*; import com.oracle.max.graal.nodes.*; import com.oracle.max.graal.nodes.extended.*; @@ -232,8 +233,8 @@ long dstAddr = GetObjectAddressNode.get(dest); long start = (dstAddr + header + destPos * 8L) >>> cardShift; long end = (dstAddr + header + (destPos + length - 1) * 8L) >>> cardShift; - long count = end - start; - while (count-- >= 0) { + long count = end - start + 1; + while (count-- > 0) { DirectStoreNode.store((start + cardStart) + count, false); } } @@ -281,7 +282,7 @@ long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object); for (long i = (length - 1) * 8; i >= 0; i -= 8) { Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object); - UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object); + DirectObjectStoreNode.store(dest, i + (destOffset + header), a); } } @@ -343,7 +344,7 @@ long header = ArrayHeaderSizeNode.sizeFor(CiKind.Object); for (long i = 0; i < length * 8L; i += 8) { Object a = UnsafeLoadNode.load(src, i + (srcOffset + header), CiKind.Object); - UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object); + DirectObjectStoreNode.store(dest, i + (destOffset + header), a); } } @@ -398,6 +399,45 @@ } } + private static class DirectObjectStoreNode extends FixedWithNextNode implements Lowerable { + @Input private ValueNode object; + @Input private ValueNode value; + @Input private ValueNode offset; + + public DirectObjectStoreNode(ValueNode object, ValueNode offset, ValueNode value) { + super(StampFactory.illegal()); + this.object = object; + this.value = value; + this.offset = offset; + } + + @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) { + 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); + WriteNode write = graph.add(new WriteNode(object, value, location)); + graph.replaceFixedWithFixed(this, write); + } + } + private static class CardTableShiftNode extends ConstantNode { public CardTableShiftNode() { super(CiConstant.forInt(CompilerImpl.getInstance().getConfig().cardtableShift));