< 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


  75 template<typename I, typename D>
  76 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
  77   STATIC_ASSERT(4 == sizeof(I));
  78   STATIC_ASSERT(4 == sizeof(D));
  79   return PrimitiveConversions::cast<D>(
  80     _Atomic_add(PrimitiveConversions::cast<jint>(add_value),
  81                 reinterpret_cast<jint volatile*>(dest)));
  82 }
  83 
  84 // Not using add_using_helper; see comment for cmpxchg.
  85 template<>
  86 template<typename I, typename D>
  87 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
  88   STATIC_ASSERT(8 == sizeof(I));
  89   STATIC_ASSERT(8 == sizeof(D));
  90   return PrimitiveConversions::cast<D>(
  91     _Atomic_add_long(PrimitiveConversions::cast<jlong>(add_value),
  92                      reinterpret_cast<jlong volatile*>(dest)));
  93 }
  94 



  95 inline jint     Atomic::xchg       (jint     exchange_value, volatile jint*     dest) {
  96   return _Atomic_xchg(exchange_value, dest);
  97 }
  98 
  99 // Not using cmpxchg_using_helper here, because some configurations of
 100 // Solaris compiler don't deal well with passing a "defined in .il"
 101 // function as an argument.  We *should* switch to using gcc-style
 102 // inline assembly, but attempting to do so with Studio 12.4 ran into
 103 // segfaults.
 104 
 105 template<>
 106 template<typename T>
 107 inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value,
 108                                                 T volatile* dest,
 109                                                 T compare_value,
 110                                                 cmpxchg_memory_order order) const {
 111   STATIC_ASSERT(1 == sizeof(T));
 112   return PrimitiveConversions::cast<T>(
 113     _Atomic_cmpxchg_byte(PrimitiveConversions::cast<jbyte>(exchange_value),
 114                          reinterpret_cast<jbyte volatile*>(dest),




  75 template<typename I, typename D>
  76 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
  77   STATIC_ASSERT(4 == sizeof(I));
  78   STATIC_ASSERT(4 == sizeof(D));
  79   return PrimitiveConversions::cast<D>(
  80     _Atomic_add(PrimitiveConversions::cast<jint>(add_value),
  81                 reinterpret_cast<jint volatile*>(dest)));
  82 }
  83 
  84 // Not using add_using_helper; see comment for cmpxchg.
  85 template<>
  86 template<typename I, typename D>
  87 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
  88   STATIC_ASSERT(8 == sizeof(I));
  89   STATIC_ASSERT(8 == sizeof(D));
  90   return PrimitiveConversions::cast<D>(
  91     _Atomic_add_long(PrimitiveConversions::cast<jlong>(add_value),
  92                      reinterpret_cast<jlong volatile*>(dest)));
  93 }
  94 
  95 template<>
  96 struct Atomic::PlatformAdd<2>: Atomic::AddShortUsingInt {};
  97 
  98 inline jint     Atomic::xchg       (jint     exchange_value, volatile jint*     dest) {
  99   return _Atomic_xchg(exchange_value, dest);
 100 }
 101 
 102 // Not using cmpxchg_using_helper here, because some configurations of
 103 // Solaris compiler don't deal well with passing a "defined in .il"
 104 // function as an argument.  We *should* switch to using gcc-style
 105 // inline assembly, but attempting to do so with Studio 12.4 ran into
 106 // segfaults.
 107 
 108 template<>
 109 template<typename T>
 110 inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value,
 111                                                 T volatile* dest,
 112                                                 T compare_value,
 113                                                 cmpxchg_memory_order order) const {
 114   STATIC_ASSERT(1 == sizeof(T));
 115   return PrimitiveConversions::cast<T>(
 116     _Atomic_cmpxchg_byte(PrimitiveConversions::cast<jbyte>(exchange_value),
 117                          reinterpret_cast<jbyte volatile*>(dest),


< prev index next >