changeset 10917:92fc1db20ad9

Fix arraycopy bug when array size is smaller than sizeof(long).
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 01 Aug 2013 16:40:59 +0200
parents 4bd4bf0b47f4
children 3736fb3dcc56
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;