< prev index next >

src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp

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


 129 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
 130   STATIC_CAST(8 == sizeof(I));
 131   STATIC_CAST(8 == sizeof(D));
 132 
 133   D result;
 134 
 135   __asm__ __volatile__ (
 136     strasm_lwsync
 137     "1: ldarx   %0,  0, %2    \n"
 138     "   add     %0, %0, %1    \n"
 139     "   stdcx.  %0,  0, %2    \n"
 140     "   bne-    1b            \n"
 141     strasm_isync
 142     : /*%0*/"=&r" (result)
 143     : /*%1*/"r" (add_value), /*%2*/"r" (dest)
 144     : "cc", "memory" );
 145 
 146   return result;
 147 }
 148 


 149 
 150 inline void Atomic::inc    (volatile jint*     dest) {
 151 
 152   unsigned int temp;
 153 
 154   __asm__ __volatile__ (
 155     strasm_nobarrier
 156     "1: lwarx   %0,  0, %2    \n"
 157     "   addic   %0, %0,  1    \n"
 158     "   stwcx.  %0,  0, %2    \n"
 159     "   bne-    1b            \n"
 160     strasm_nobarrier
 161     : /*%0*/"=&r" (temp), "=m" (*dest)
 162     : /*%2*/"r" (dest), "m" (*dest)
 163     : "cc" strasm_nobarrier_clobber_memory);
 164 
 165 }
 166 
 167 inline void Atomic::inc_ptr(volatile intptr_t* dest) {
 168 




 129 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
 130   STATIC_CAST(8 == sizeof(I));
 131   STATIC_CAST(8 == sizeof(D));
 132 
 133   D result;
 134 
 135   __asm__ __volatile__ (
 136     strasm_lwsync
 137     "1: ldarx   %0,  0, %2    \n"
 138     "   add     %0, %0, %1    \n"
 139     "   stdcx.  %0,  0, %2    \n"
 140     "   bne-    1b            \n"
 141     strasm_isync
 142     : /*%0*/"=&r" (result)
 143     : /*%1*/"r" (add_value), /*%2*/"r" (dest)
 144     : "cc", "memory" );
 145 
 146   return result;
 147 }
 148 
 149 template<>
 150 struct Atomic::PlatformAdd<2>: Atomic::AddShortUsingInt {};
 151 
 152 inline void Atomic::inc    (volatile jint*     dest) {
 153 
 154   unsigned int temp;
 155 
 156   __asm__ __volatile__ (
 157     strasm_nobarrier
 158     "1: lwarx   %0,  0, %2    \n"
 159     "   addic   %0, %0,  1    \n"
 160     "   stwcx.  %0,  0, %2    \n"
 161     "   bne-    1b            \n"
 162     strasm_nobarrier
 163     : /*%0*/"=&r" (temp), "=m" (*dest)
 164     : /*%2*/"r" (dest), "m" (*dest)
 165     : "cc" strasm_nobarrier_clobber_memory);
 166 
 167 }
 168 
 169 inline void Atomic::inc_ptr(volatile intptr_t* dest) {
 170 


< prev index next >