changeset in /hg/icedtea6: 2009-01-27 Andrew Haley <aph at redhat...
Andrew Haley
aph at redhat.com
Tue Jan 27 03:28:06 PST 2009
changeset 9101fe01989c in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=9101fe01989c
description:
2009-01-27 Andrew Haley <aph at redhat.com>
* ports/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp:
Add memory barriers where needed for PPC.
diffstat:
2 files changed, 69 insertions(+), 24 deletions(-)
ChangeLog | 5
ports/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp | 88 +++++++---
diffs (149 lines):
diff -r 86cc7eb0035f -r 9101fe01989c ChangeLog
--- a/ChangeLog Mon Jan 26 09:09:26 2009 -0500
+++ b/ChangeLog Tue Jan 27 11:27:58 2009 +0000
@@ -1,3 +1,8 @@ 2009-01-26 Lillian Angel <langel at redha
+2009-01-27 Andrew Haley <aph at redhat.com>
+
+ * ports/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp:
+ Add memory barriers where needed for PPC.
+
2009-01-26 Lillian Angel <langel at redhat.com>
* configure.ac: Updated to pre-1.5 version.
diff -r 86cc7eb0035f -r 9101fe01989c ports/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp
--- a/ports/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp Mon Jan 26 09:09:26 2009 -0500
+++ b/ports/hotspot/src/os_cpu/linux_zero/vm/orderAccess_linux_zero.inline.hpp Tue Jan 27 11:27:58 2009 +0000
@@ -23,6 +23,24 @@
*
*/
+#ifdef __PPC
+
+#define READ_MEM_BARRIER __asm __volatile ("isync":::"memory")
+#ifdef __NO_LWSYNC__
+#define WRITE_MEM_BARRIER __asm __volatile ("sync":::"memory")
+#else
+#define WRITE_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
+#endif
+
+#else // PPC
+
+#define READ_MEM_BARRIER __asm __volatile ("":::"memory")
+#define WRITE_MEM_BARRIER __asm __volatile ("":::"memory")
+
+#endif // PPC
+
+
+
inline void OrderAccess::loadload() { acquire(); }
inline void OrderAccess::storestore() { release(); }
inline void OrderAccess::loadstore() { acquire(); }
@@ -30,12 +48,12 @@ inline void OrderAccess::storeload() {
inline void OrderAccess::acquire()
{
- __sync_synchronize();
+ READ_MEM_BARRIER;
}
inline void OrderAccess::release()
{
- __sync_synchronize();
+ WRITE_MEM_BARRIER;
}
inline void OrderAccess::fence()
@@ -43,49 +61,71 @@ inline void OrderAccess::fence()
__sync_synchronize();
}
-inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { return *p; }
-inline jshort OrderAccess::load_acquire(volatile jshort* p) { return *p; }
-inline jint OrderAccess::load_acquire(volatile jint* p) { return *p; }
+inline jbyte OrderAccess::load_acquire(volatile jbyte* p) { jbyte data = *p; acquire(); return data; }
+inline jshort OrderAccess::load_acquire(volatile jshort* p) { jshort data = *p; acquire(); return data; }
+inline jint OrderAccess::load_acquire(volatile jint* p) { jint data = *p; acquire(); return data; }
inline jlong OrderAccess::load_acquire(volatile jlong* p)
{
jlong tmp;
os::atomic_copy64(p, &tmp);
+ acquire();
return tmp;
}
-inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; }
-inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
-inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
+inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { jubyte data = *p; acquire(); return data; }
+inline jushort OrderAccess::load_acquire(volatile jushort* p) { jushort data = *p; acquire(); return data; }
+inline juint OrderAccess::load_acquire(volatile juint* p) { juint data = *p; acquire(); return data; }
inline julong OrderAccess::load_acquire(volatile julong* p)
{
julong tmp;
os::atomic_copy64(p, &tmp);
+ acquire();
return tmp;
}
-inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
+inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { jfloat data = *p; acquire(); return data; }
inline jdouble OrderAccess::load_acquire(volatile jdouble* p)
{
jdouble tmp;
os::atomic_copy64(p, &tmp);
+ acquire();
return tmp;
}
-inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
-inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
-inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
+inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p)
+{
+ intptr_t data = *p;
+ acquire();
+ return data;
+}
+inline void* OrderAccess::load_ptr_acquire(volatile void* p)
+{
+ void *data = *(void* volatile *)p;
+ acquire();
+ return data;
+}
+inline void* OrderAccess::load_ptr_acquire(const volatile void* p)
+{
+ void *data = *(void* const volatile *)p;
+ acquire();
+ return data;
+}
-inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { *p = v; }
-inline void OrderAccess::release_store(volatile jshort* p, jshort v) { *p = v; }
-inline void OrderAccess::release_store(volatile jint* p, jint v) { *p = v; }
-inline void OrderAccess::release_store(volatile jlong* p, jlong v) { os::atomic_copy64(&v, p); }
-inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; }
-inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
-inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
-inline void OrderAccess::release_store(volatile julong* p, julong v) { os::atomic_copy64(&v, p); }
-inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
-inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { os::atomic_copy64(&v, p); }
+inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile jshort* p, jshort v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile jint* p, jint v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile jlong* p, jlong v)
+{ release(); os::atomic_copy64(&v, p); }
+inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile jushort* p, jushort v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile juint* p, juint v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile julong* p, julong v)
+{ release(); os::atomic_copy64(&v, p); }
+inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { release(); *p = v; }
+inline void OrderAccess::release_store(volatile jdouble* p, jdouble v)
+{ release(); os::atomic_copy64(&v, p); }
-inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
-inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
+inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { release(); *p = v; }
+inline void OrderAccess::release_store_ptr(volatile void* p, void* v)
+{ release(); *(void* volatile *)p = v; }
inline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); }
inline void OrderAccess::store_fence(jshort* p, jshort v) { *p = v; fence(); }
More information about the distro-pkg-dev
mailing list