-
Bug
-
Resolution: Fixed
-
P3
-
21
-
b18
-
aarch64
From some tests, we find System.arraycopy() call with negated small length does not work on AArch64 CPUs with SVE. Below simple Java program can reproduce this issue.
public class Test {
static char[] src = {'A', 'A', 'A', 'A', 'A'};
static char[] dst = {'B', 'B', 'B', 'B', 'B'};
static void copy(int nlen) {
System.arraycopy(src, 0, dst, 0, -nlen);
}
public static void main(String[] args) {
for (int i = 0; i < 25000; i++) {
copy(0);
}
copy(-5);
for (char c : dst) {
if (c != 'A') {
throw new RuntimeException("Wrong value!");
}
}
System.out.println("PASS");
}
}
/*
$ java -Xint Test
PASS
$ java -Xbatch Test
Exception in thread "main" java.lang.RuntimeException: Wrong value!
at Test.main(Test.java:16)
*/
Investigation shows this issue is caused by a new AArch64 matching rule vmask_gen_sub introduced inJDK-8293198. We should fix it ASAP.
public class Test {
static char[] src = {'A', 'A', 'A', 'A', 'A'};
static char[] dst = {'B', 'B', 'B', 'B', 'B'};
static void copy(int nlen) {
System.arraycopy(src, 0, dst, 0, -nlen);
}
public static void main(String[] args) {
for (int i = 0; i < 25000; i++) {
copy(0);
}
copy(-5);
for (char c : dst) {
if (c != 'A') {
throw new RuntimeException("Wrong value!");
}
}
System.out.println("PASS");
}
}
/*
$ java -Xint Test
PASS
$ java -Xbatch Test
Exception in thread "main" java.lang.RuntimeException: Wrong value!
at Test.main(Test.java:16)
*/
Investigation shows this issue is caused by a new AArch64 matching rule vmask_gen_sub introduced in
- relates to
-
JDK-8293198 [vectorapi] Improve the implementation of VectorMask.indexInRange()
-
- Resolved
-