src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp
changeset 47552 8a3599d60996
parent 47216 71c04702a3d5
child 47578 09c41c4913d9
equal deleted inserted replaced
47551:4d034d861e13 47552:8a3599d60996
    79 template<typename I, typename D>
    79 template<typename I, typename D>
    80 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
    80 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
    81   return add_using_helper<intptr_t>(os::atomic_add_ptr_func, add_value, dest);
    81   return add_using_helper<intptr_t>(os::atomic_add_ptr_func, add_value, dest);
    82 }
    82 }
    83 
    83 
    84 inline void Atomic::inc    (volatile jint*     dest) {
       
    85   (void)add    (1, dest);
       
    86 }
       
    87 
       
    88 inline void Atomic::inc_ptr(volatile intptr_t* dest) {
       
    89   (void)add_ptr(1, dest);
       
    90 }
       
    91 
       
    92 inline void Atomic::inc_ptr(volatile void*     dest) {
       
    93   (void)add_ptr(1, dest);
       
    94 }
       
    95 
       
    96 inline void Atomic::dec    (volatile jint*     dest) {
       
    97   (void)add    (-1, dest);
       
    98 }
       
    99 
       
   100 inline void Atomic::dec_ptr(volatile intptr_t* dest) {
       
   101   (void)add_ptr(-1, dest);
       
   102 }
       
   103 
       
   104 inline void Atomic::dec_ptr(volatile void*     dest) {
       
   105   (void)add_ptr(-1, dest);
       
   106 }
       
   107 
       
   108 inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
    84 inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
   109   return (jint)(*os::atomic_xchg_func)(exchange_value, dest);
    85   return (jint)(*os::atomic_xchg_func)(exchange_value, dest);
   110 }
    86 }
   111 
    87 
   112 inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
    88 inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
   148     mov eax, add_value;
   124     mov eax, add_value;
   149     mov ecx, eax;
   125     mov ecx, eax;
   150     lock xadd dword ptr [edx], eax;
   126     lock xadd dword ptr [edx], eax;
   151     add eax, ecx;
   127     add eax, ecx;
   152   }
   128   }
   153 }
       
   154 
       
   155 inline void Atomic::inc    (volatile jint*     dest) {
       
   156   // alternative for InterlockedIncrement
       
   157   __asm {
       
   158     mov edx, dest;
       
   159     lock add dword ptr [edx], 1;
       
   160   }
       
   161 }
       
   162 
       
   163 inline void Atomic::inc_ptr(volatile intptr_t* dest) {
       
   164   inc((volatile jint*)dest);
       
   165 }
       
   166 
       
   167 inline void Atomic::inc_ptr(volatile void*     dest) {
       
   168   inc((volatile jint*)dest);
       
   169 }
       
   170 
       
   171 inline void Atomic::dec    (volatile jint*     dest) {
       
   172   // alternative for InterlockedDecrement
       
   173   __asm {
       
   174     mov edx, dest;
       
   175     lock sub dword ptr [edx], 1;
       
   176   }
       
   177 }
       
   178 
       
   179 inline void Atomic::dec_ptr(volatile intptr_t* dest) {
       
   180   dec((volatile jint*)dest);
       
   181 }
       
   182 
       
   183 inline void Atomic::dec_ptr(volatile void*     dest) {
       
   184   dec((volatile jint*)dest);
       
   185 }
   129 }
   186 
   130 
   187 inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
   131 inline jint     Atomic::xchg    (jint     exchange_value, volatile jint*     dest) {
   188   // alternative for InterlockedExchange
   132   // alternative for InterlockedExchange
   189   __asm {
   133   __asm {