Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8305524

AArch64: Fix arraycopy issue on SVE caused by matching rule vmask_gen_sub

    XMLWordPrintable

Details

    • b18
    • aarch64

    Description

      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 in JDK-8293198. We should fix it ASAP.

      Attachments

        Issue Links

          Activity

            People

              pli Pengfei Li
              pli Pengfei Li
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: