File zero-atomic_copy64.patch of Package java-9-openjdk
--- jdk9/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp 2018-01-22 16:19:02.000000000 +0100
+++ jdk9/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp 2019-04-08 11:34:04.644649534 +0200
@@ -36,20 +36,36 @@
// Atomically copy 64 bits of data
static void atomic_copy64(volatile void *src, volatile void *dst) {
-#if defined(PPC32)
+#if defined(PPC32) && !defined(__SPE__)
double tmp;
- asm volatile ("lfd %0, 0(%1)\n"
- "stfd %0, 0(%2)\n"
- : "=f"(tmp)
- : "b"(src), "b"(dst));
+ asm volatile ("lfd %0, %2\n"
+ "stfd %0, %1\n"
+ : "=&f"(tmp), "=Q"(*(volatile double*)dst)
+ : "Q"(*(volatile double*)src));
+#elif defined(PPC32) && defined(__SPE__)
+ long tmp;
+ asm volatile ("evldd %0, %2\n"
+ "evstdd %0, %1\n"
+ : "=&r"(tmp), "=Q"(*(volatile long*)dst)
+ : "Q"(*(volatile long*)src));
#elif defined(S390) && !defined(_LP64)
double tmp;
- asm volatile ("ld %0, 0(%1)\n"
- "std %0, 0(%2)\n"
+ asm volatile ("ld %0, %2\n"
+ "std %0, %1\n"
+ : "=&f"(tmp), "=Q"(*(volatile double*)dst)
+ : "Q"(*(volatile double*)src));
+#elif defined(__ARM_ARCH_7A__)
+ // Note that a ldrexd + clrex combination is only needed for
+ // correctness on the OS level (context-switches). In this
+ // case, clrex *may* be beneficial for performance. For now
+ // don't bother with clrex as this is Zero.
+ jlong tmp;
+ asm volatile ("ldrexd %0, [%1]\n"
: "=r"(tmp)
- : "a"(src), "a"(dst));
+ : "r"(src), "m"(src));
+ *(jlong *) dst = tmp;
#else
- *(jlong *) dst = *(jlong *) src;
+ *(jlong *) dst = *(const jlong *) src;
#endif
}