# HG changeset patch # User Roland Schatz # Date 1375368059 -7200 # Node ID 92fc1db20ad95ccb1d7ee91a7b63b4c867560f97 # Parent 4bd4bf0b47f4f13993f0d10e89b2bdb16321c45c Fix arraycopy bug when array size is smaller than sizeof(long). diff -r 4bd4bf0b47f4 -r 92fc1db20ad9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java Tue Jul 30 16:42:51 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java Thu Aug 01 16:40:59 2013 +0200 @@ -59,7 +59,7 @@ long postLoopBytes; // We can easily vectorize the loop if both offsets have the same alignment. - if ((srcOffset % VECTOR_SIZE) == (destOffset % VECTOR_SIZE)) { + if (byteLength >= VECTOR_SIZE && (srcOffset % VECTOR_SIZE) == (destOffset % VECTOR_SIZE)) { preLoopBytes = NumUtil.roundUp(arrayBaseOffset + srcOffset, VECTOR_SIZE) - (arrayBaseOffset + srcOffset); postLoopBytes = (byteLength - preLoopBytes) % VECTOR_SIZE; mainLoopBytes = byteLength - preLoopBytes - postLoopBytes;