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

aarch32: array copy stub copies wrong data count

XMLWordPrintable

    • aarch32
    • linux

      Current implementation of aarch32 array_copy_stub relies on word size to be 8 bytes, as it is on aarch64; it leads to less bytes copied than it should. Problem arises with copy of longs and copy of small number of elements. Test below demonstrates the issue:

      === Test ===
      import java.lang.System;

      class TestArrayCopy {
              static void test1() {
                      long a0[] = { 0, 0 };
                      long a1[] = { 1, 1 };
                      System.arraycopy(a1, 0, a0, 0, 2); // should be inlined
                      System.out.print(a0[1] == 1 ? "OK\n" : "FAIL\n");
              }

              static void test2() {
                      int a10[] = { 0, 0, 0 };
                      int a11[] = { 1, 1, 1 };
                      System.arraycopy(a11, 0, a10, 0, 3); // should be inlined
                      System.out.print(a10[2] == 1 ? "OK\n" : "FAIL\n");
              }

              public static void main(String[] args) {
                      int a0[] = { 0 };
                      int a1[] = { 0 };
                      System.arraycopy(a1, 0, a0, 0, 1); // loads class

      // System class should be loaded at the moment,
      // test methods should not be inlined
                      test1();
                      test2();
              }
      }

      === End Of Test ===

            enevill Ed Nevill
            enevill Ed Nevill
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: