Mercurial > hg > graal-compiler
comparison src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp @ 11157:4614a598dae1
8016538: volatile double access via Unsafe.cpp is not atomic
Summary: volatile jdouble load/store is not atomic, fix by using of existing volatile jlong operations which are atomic for jdouble.
Reviewed-by: kvn, vladidan, jrose
Contributed-by: david.holmes@oracle.com
author | minqi |
---|---|
date | Fri, 19 Jul 2013 08:34:48 -0700 |
parents | 63e54c37ac64 |
children |
comparison
equal
deleted
inserted
replaced
11155:383a5e21cc2d | 11157:4614a598dae1 |
---|---|
86 inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; } | 86 inline jubyte OrderAccess::load_acquire(volatile jubyte* p) { return *p; } |
87 inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; } | 87 inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; } |
88 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } | 88 inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; } |
89 inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } | 89 inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); } |
90 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } | 90 inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; } |
91 inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; } | 91 inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); } |
92 | 92 |
93 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } | 93 inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; } |
94 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } | 94 inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; } |
95 inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; } | 95 inline void* OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; } |
96 | 96 |
101 inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; } | 101 inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) { *p = v; } |
102 inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; } | 102 inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; } |
103 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } | 103 inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; } |
104 inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } | 104 inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); } |
105 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } | 105 inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; } |
106 inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; } | 106 inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong*)p, jlong_cast(v)); } |
107 | 107 |
108 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } | 108 inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; } |
109 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } | 109 inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; } |
110 | 110 |
111 inline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); } | 111 inline void OrderAccess::store_fence(jbyte* p, jbyte v) { *p = v; fence(); } |
127 inline void OrderAccess::release_store_fence(volatile jint* p, jint v) { *p = v; fence(); } | 127 inline void OrderAccess::release_store_fence(volatile jint* p, jint v) { *p = v; fence(); } |
128 inline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { release_store(p, v); fence(); } | 128 inline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { release_store(p, v); fence(); } |
129 inline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { *p = v; fence(); } | 129 inline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { *p = v; fence(); } |
130 inline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); } | 130 inline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); } |
131 inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { *p = v; fence(); } | 131 inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { *p = v; fence(); } |
132 inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store(p, v); fence(); } | 132 inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store((jlong *)p, (jlong)v); fence(); } |
133 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); } | 133 inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); } |
134 inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); } | 134 inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jlong_cast(v)); } |
135 | 135 |
136 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { *p = v; fence(); } | 136 inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { *p = v; fence(); } |
137 inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { *(void* volatile *)p = v; fence(); } | 137 inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { *(void* volatile *)p = v; fence(); } |
138 | 138 |
139 #endif // OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP | 139 #endif // OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP |