summaryrefslogtreecommitdiffstats
path: root/recipes-core/openjdk/openjdk-6-6b24/icedtea-jdk-powerpc-atomic64.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/openjdk/openjdk-6-6b24/icedtea-jdk-powerpc-atomic64.patch')
-rw-r--r--recipes-core/openjdk/openjdk-6-6b24/icedtea-jdk-powerpc-atomic64.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/recipes-core/openjdk/openjdk-6-6b24/icedtea-jdk-powerpc-atomic64.patch b/recipes-core/openjdk/openjdk-6-6b24/icedtea-jdk-powerpc-atomic64.patch
new file mode 100644
index 0000000..cc5e4e8
--- /dev/null
+++ b/recipes-core/openjdk/openjdk-6-6b24/icedtea-jdk-powerpc-atomic64.patch
@@ -0,0 +1,65 @@
1http://mail.openjdk.java.net/pipermail/zero-dev/2010-June/000346.html
2
3this cute C code does the same thing on powerpc as the assembly code that
4was here before. If the compiler was built with the SPE extensions instead
5of traditional FPU and double operations are performed in HW then we are
6one step further: The compiler turns this into evldd & evstdd. Voila :)
7
8This C code could also be activated on s390. The compiler turns this into
9a single mvc instruction which does the copy operation. I don't know if
10mvc's copy ability is atomic _or_ not and therefore I leave it as it.
11
12Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
13
14./openjdk-src-dir/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp
15Index: openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp
16===================================================================
17--- openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp.org 2011-11-14 14:07:32.000000000 -0800
18+++ openjdk/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp 2012-07-19 07:28:26.208405923 -0700
19@@ -25,6 +25,16 @@
20
21 #ifndef OS_CPU_LINUX_ZERO_VM_OS_LINUX_ZERO_HPP
22 #define OS_CPU_LINUX_ZERO_VM_OS_LINUX_ZERO_HPP
23+#if defined(PPC) && !defined(_LP64)
24+
25+#ifndef __NO_FPRS__
26+#define ATOMIC64_COPY_THROUGH_DOUBLE 1
27+
28+#elif defined(__SPE__) && !defined(_SOFT_DOUBLE)
29+#define ATOMIC64_COPY_THROUGH_DOUBLE 1
30+
31+#endif
32+#endif
33
34 static void setup_fpu() {}
35
36@@ -36,12 +46,23 @@
37
38 // Atomically copy 64 bits of data
39 static void atomic_copy64(volatile void *src, volatile void *dst) {
40-#if defined(PPC) && !defined(_LP64)
41- double tmp;
42- asm volatile ("lfd %0, 0(%1)\n"
43- "stfd %0, 0(%2)\n"
44- : "=f"(tmp)
45- : "b"(src), "b"(dst));
46+#if ATOMIC64_COPY_THROUGH_DOUBLE
47+ /*
48+ * In order to copy 8 bytes atomicly we rely on the trick that some
49+ * architectures can load and store a double as a single operation.
50+ * gcc picks the correct opcode here and with optimization turned on
51+ * all temporary assignments are gone. - bigeasy
52+ */
53+ union {
54+ double *d;
55+ volatile void *v;
56+ } s, d;
57+
58+ s.v = src;
59+ d.v = dst;
60+
61+ *d.d = *s.d;
62+
63 #elif defined(S390) && !defined(_LP64)
64 double tmp;
65 asm volatile ("ld %0, 0(%1)\n"