< prev index next >

src/os_cpu/solaris_x86/vm/atomic_solaris_x86.hpp

Print this page
rev 13452 : imported patch Atomic_cmpxchg
rev 13453 : imported patch Atomic_add
rev 13454 : [mq]: Atomic_add_v2

*** 49,71 **** // For Sun Studio - implementation is in solaris_x86_64.il. extern "C" { jint _Atomic_add(jint add_value, volatile jint* dest); jint _Atomic_xchg(jint exchange_value, volatile jint* dest); jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value); jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, jlong compare_value); } ! inline jint Atomic::add (jint add_value, volatile jint* dest) { ! return _Atomic_add(add_value, dest); } inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) { return _Atomic_xchg(exchange_value, dest); } // Not using cmpxchg_using_helper here, because some configurations of --- 49,102 ---- // For Sun Studio - implementation is in solaris_x86_64.il. extern "C" { jint _Atomic_add(jint add_value, volatile jint* dest); + jlong _Atomic_add_long(jlong add_value, volatile jlong* dest); + jint _Atomic_xchg(jint exchange_value, volatile jint* dest); jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value); jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value); jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, jlong compare_value); } ! template<size_t byte_size> ! struct Atomic::PlatformAdd ! : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> > ! { ! template<typename I, typename D> ! D add_and_fetch(I add_value, D volatile* dest) const; ! }; ! ! // Not using add_using_helper; see comment for cmpxchg. ! template<> ! template<typename I, typename D> ! inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { ! STATIC_ASSERT(4 == sizeof(I)); ! STATIC_ASSERT(4 == sizeof(D)); ! return PrimitiveConversions::cast<D>( ! _Atomic_add(PrimitiveConversions::cast<jint>(add_value), ! reinterpret_cast<jint volatile*>(dest))); ! } ! ! // Not using add_using_helper; see comment for cmpxchg. ! template<> ! template<typename I, typename D> ! inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { ! STATIC_ASSERT(8 == sizeof(I)); ! STATIC_ASSERT(8 == sizeof(D)); ! return PrimitiveConversions::cast<D>( ! _Atomic_add_long(PrimitiveConversions::cast<jlong>(add_value), ! reinterpret_cast<jlong volatile*>(dest))); } + template<> + struct Atomic::PlatformAdd<2>: Atomic::AddShortUsingInt {}; + inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) { return _Atomic_xchg(exchange_value, dest); } // Not using cmpxchg_using_helper here, because some configurations of
*** 113,133 **** PrimitiveConversions::cast<jlong>(compare_value))); } inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; } inline void Atomic::store (jlong store_value, volatile jlong* dest) { *dest = store_value; } - extern "C" jlong _Atomic_add_long(jlong add_value, volatile jlong* dest); extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest); - inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) { - return (intptr_t)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest); - } - - inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) { - return (void*)_Atomic_add_long((jlong)add_value, (volatile jlong*)dest); - } - inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) { return (intptr_t)_Atomic_xchg_long((jlong)exchange_value, (volatile jlong*)dest); } inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) { --- 144,155 ----
< prev index next >