# HG changeset patch # User Gilles Duboscq # Date 1328113403 -3600 # Node ID fe11e8522eb3ae20fa36325bb0529a3dd193d646 # Parent e8ce691d7923e056a59bae6964efcf1621645a2c Fix array copy snippet's write barrier diff -r e8ce691d7923 -r fe11e8522eb3 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 16:54:44 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/snippets/ArrayCopySnippets.java Wed Feb 01 17:23:23 2012 +0100 @@ -334,14 +334,14 @@ UnsafeStoreNode.store(dest, i + (destOffset + header), a, CiKind.Object); } if (length > 0) { - long cardShift = CardTableShiftNode.get(); + int cardShift = CardTableShiftNode.get(); long cardStart = CardTableStartNode.get(); long dstAddr = GetObjectAddressNode.get(dest); - long count = (8 * (length - 1)) >>> cardShift; - long start = ((dstAddr + header + destOffset) >>> cardShift) + cardStart; - - while (count-- > 0) { - DirectStoreNode.store(start + count, false); + long start = (dstAddr + header + destOffset) >>> cardShift; + long end = (dstAddr + header + destOffset + 8L * (length - 1)) >>> cardShift; + long count = end - start; + while (count-- >= 0) { + DirectStoreNode.store((start + cardStart) + count, false); } }