# HG changeset patch # User redestad # Date 1495016009 -7200 # Node ID 799dda2aaaf5deec5370a9f5b9c0378890d565ad # Parent f0f38f5ac34fc9f1940af47617c2b8fd562ae0a9 8180479: [TESTBUG] Some hotspot tests broken after internal Unsafe name changes Reviewed-by: thartmann diff -r f0f38f5ac34f -r 799dda2aaaf5 hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java --- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java Wed May 17 11:41:08 2017 +0200 +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java Wed May 17 12:13:29 2017 +0200 @@ -773,221 +773,221 @@ static void test_ci(int[] a) { for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -1, -123); + unsafe.compareAndSetInt(a, byte_offset(i), -1, -123); } } static void test_vi(int[] a, int b, int old) { for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), old, b); + unsafe.compareAndSetInt(a, byte_offset(i), old, b); } } static void test_cp(int[] a, int[] b) { for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]); + unsafe.compareAndSetInt(a, byte_offset(i), -123, b[i]); } } static void test_2ci(int[] a, int[] b) { for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123); - unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103); + unsafe.compareAndSetInt(a, byte_offset(i), 123, -123); + unsafe.compareAndSetInt(b, byte_offset(i), 123, -103); } } static void test_2vi(int[] a, int[] b, int c, int d) { for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -123, c); - unsafe.compareAndSwapInt(b, byte_offset(i), -103, d); + unsafe.compareAndSetInt(a, byte_offset(i), -123, c); + unsafe.compareAndSetInt(b, byte_offset(i), -103, d); } } static void test_ci_neg(int[] a, int old) { for (int i = ARRLEN-1; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), old, -123); + unsafe.compareAndSetInt(a, byte_offset(i), old, -123); } } static void test_vi_neg(int[] a, int b, int old) { for (int i = ARRLEN-1; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), old, b); + unsafe.compareAndSetInt(a, byte_offset(i), old, b); } } static void test_cp_neg(int[] a, int[] b) { for (int i = ARRLEN-1; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]); + unsafe.compareAndSetInt(a, byte_offset(i), -123, b[i]); } } static void test_2ci_neg(int[] a, int[] b) { for (int i = ARRLEN-1; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123); - unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103); + unsafe.compareAndSetInt(a, byte_offset(i), 123, -123); + unsafe.compareAndSetInt(b, byte_offset(i), 123, -103); } } static void test_2vi_neg(int[] a, int[] b, int c, int d) { for (int i = ARRLEN-1; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -123, c); - unsafe.compareAndSwapInt(b, byte_offset(i), -103, d); + unsafe.compareAndSetInt(a, byte_offset(i), -123, c); + unsafe.compareAndSetInt(b, byte_offset(i), -103, d); } } static void test_ci_oppos(int[] a, int old) { int limit = ARRLEN-1; for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, -123); + unsafe.compareAndSetInt(a, byte_offset(limit-i), old, -123); } } static void test_vi_oppos(int[] a, int b, int old) { int limit = ARRLEN-1; for (int i = limit; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, b); + unsafe.compareAndSetInt(a, byte_offset(limit-i), old, b); } } static void test_cp_oppos(int[] a, int[] b) { int limit = ARRLEN-1; for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[limit-i]); + unsafe.compareAndSetInt(a, byte_offset(i), -123, b[limit-i]); } } static void test_2ci_oppos(int[] a, int[] b) { int limit = ARRLEN-1; for (int i = 0; i < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(limit-i), 123, -123); - unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103); + unsafe.compareAndSetInt(a, byte_offset(limit-i), 123, -123); + unsafe.compareAndSetInt(b, byte_offset(i), 123, -103); } } static void test_2vi_oppos(int[] a, int[] b, int c, int d) { int limit = ARRLEN-1; for (int i = limit; i >= 0; i-=1) { - unsafe.compareAndSwapInt(a, byte_offset(i), -123, c); - unsafe.compareAndSwapInt(b, byte_offset(limit-i), -103, d); + unsafe.compareAndSetInt(a, byte_offset(i), -123, c); + unsafe.compareAndSetInt(b, byte_offset(limit-i), -103, d); } } static void test_ci_off(int[] a, int old) { for (int i = 0; i < ARRLEN-OFFSET; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, -123); + unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), old, -123); } } static void test_vi_off(int[] a, int b, int old) { for (int i = 0; i < ARRLEN-OFFSET; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, b); + unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), old, b); } } static void test_cp_off(int[] a, int[] b) { for (int i = 0; i < ARRLEN-OFFSET; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]); + unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]); } } static void test_2ci_off(int[] a, int[] b) { for (int i = 0; i < ARRLEN-OFFSET; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), 123, -123); - unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), 123, -103); + unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), 123, -123); + unsafe.compareAndSetInt(b, byte_offset(i+OFFSET), 123, -103); } } static void test_2vi_off(int[] a, int[] b, int c, int d) { for (int i = 0; i < ARRLEN-OFFSET; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, c); - unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), -103, d); + unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), -123, c); + unsafe.compareAndSetInt(b, byte_offset(i+OFFSET), -103, d); } } static void test_ci_inv(int[] a, int k, int old) { for (int i = 0; i < ARRLEN-k; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+k), old, -123); + unsafe.compareAndSetInt(a, byte_offset(i+k), old, -123); } } static void test_vi_inv(int[] a, int b, int k, int old) { for (int i = 0; i < ARRLEN-k; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+k), old, b); + unsafe.compareAndSetInt(a, byte_offset(i+k), old, b); } } static void test_cp_inv(int[] a, int[] b, int k) { for (int i = 0; i < ARRLEN-k; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, b[i+k]); + unsafe.compareAndSetInt(a, byte_offset(i+k), -123, b[i+k]); } } static void test_2ci_inv(int[] a, int[] b, int k) { for (int i = 0; i < ARRLEN-k; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+k), 123, -123); - unsafe.compareAndSwapInt(b, byte_offset(i+k), 123, -103); + unsafe.compareAndSetInt(a, byte_offset(i+k), 123, -123); + unsafe.compareAndSetInt(b, byte_offset(i+k), 123, -103); } } static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) { for (int i = 0; i < ARRLEN-k; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, c); - unsafe.compareAndSwapInt(b, byte_offset(i+k), -103, d); + unsafe.compareAndSetInt(a, byte_offset(i+k), -123, c); + unsafe.compareAndSetInt(b, byte_offset(i+k), -103, d); } } static void test_ci_scl(int[] a, int old) { for (int i = 0; i*SCALE < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, -123); + unsafe.compareAndSetInt(a, byte_offset(i*SCALE), old, -123); } } static void test_vi_scl(int[] a, int b, int old) { for (int i = 0; i*SCALE < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, b); + unsafe.compareAndSetInt(a, byte_offset(i*SCALE), old, b); } } static void test_cp_scl(int[] a, int[] b) { for (int i = 0; i*SCALE < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]); + unsafe.compareAndSetInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]); } } static void test_2ci_scl(int[] a, int[] b) { for (int i = 0; i*SCALE < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), 123, -123); - unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), 123, -103); + unsafe.compareAndSetInt(a, byte_offset(i*SCALE), 123, -123); + unsafe.compareAndSetInt(b, byte_offset(i*SCALE), 123, -103); } } static void test_2vi_scl(int[] a, int[] b, int c, int d) { for (int i = 0; i*SCALE < ARRLEN; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, c); - unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), -103, d); + unsafe.compareAndSetInt(a, byte_offset(i*SCALE), -123, c); + unsafe.compareAndSetInt(b, byte_offset(i*SCALE), -103, d); } } static void test_cp_alndst(int[] a, int[] b) { for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]); + unsafe.compareAndSetInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]); } } static void test_cp_alnsrc(int[] a, int[] b) { for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { int old = unsafe.getIntVolatile(a, byte_offset(i)); - unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+ALIGN_OFF]); + unsafe.compareAndSetInt(a, byte_offset(i), old, b[i+ALIGN_OFF]); } } static void test_2ci_aln(int[] a, int[] b) { for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, -123); + unsafe.compareAndSetInt(a, byte_offset(i+ALIGN_OFF), -1, -123); int old = unsafe.getIntVolatile(b, byte_offset(i)); - unsafe.compareAndSwapInt(b, byte_offset(i), old, -103); + unsafe.compareAndSetInt(b, byte_offset(i), old, -103); } } static void test_2vi_aln(int[] a, int[] b, int c, int d) { for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) { int old = unsafe.getIntVolatile(a, byte_offset(i)); - unsafe.compareAndSwapInt(a, byte_offset(i), old, c); + unsafe.compareAndSetInt(a, byte_offset(i), old, c); old = unsafe.getIntVolatile(b, byte_offset(i+ALIGN_OFF)); - unsafe.compareAndSwapInt(b, byte_offset(i+ALIGN_OFF), old, d); + unsafe.compareAndSetInt(b, byte_offset(i+ALIGN_OFF), old, d); } } static void test_cp_unalndst(int[] a, int[] b) { for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]); + unsafe.compareAndSetInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]); } } static void test_cp_unalnsrc(int[] a, int[] b) { for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { int old = unsafe.getIntVolatile(a, byte_offset(i)); - unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]); + unsafe.compareAndSetInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]); } } static void test_2ci_unaln(int[] a, int[] b) { for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { - unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, -123); + unsafe.compareAndSetInt(a, byte_offset(i+UNALIGN_OFF), -1, -123); int old = unsafe.getIntVolatile(b, byte_offset(i)); - unsafe.compareAndSwapInt(b, byte_offset(i), old, -103); + unsafe.compareAndSetInt(b, byte_offset(i), old, -103); } } static void test_2vi_unaln(int[] a, int[] b, int c, int d) { for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) { int old = unsafe.getIntVolatile(a, byte_offset(i)); - unsafe.compareAndSwapInt(a, byte_offset(i), old, c); + unsafe.compareAndSetInt(a, byte_offset(i), old, c); old = unsafe.getIntVolatile(b, byte_offset(i+UNALIGN_OFF)); - unsafe.compareAndSwapInt(b, byte_offset(i+UNALIGN_OFF), old, d); + unsafe.compareAndSetInt(b, byte_offset(i+UNALIGN_OFF), old, d); } } diff -r f0f38f5ac34f -r 799dda2aaaf5 hotspot/test/compiler/profiling/UnsafeAccess.java --- a/hotspot/test/compiler/profiling/UnsafeAccess.java Wed May 17 11:41:08 2017 +0200 +++ b/hotspot/test/compiler/profiling/UnsafeAccess.java Wed May 17 12:13:29 2017 +0200 @@ -64,7 +64,7 @@ static Object helperUnsafeLoadStore(Object o, boolean isObjArray) { if (isObjArray) { Object o1 = U.getObject(o, off); - U.compareAndSwapObject(o, off, o1, new Object()); + U.compareAndSetObject(o, off, o1, new Object()); } return o; }