equal
deleted
inserted
replaced
77 } |
77 } |
78 |
78 |
79 #define DEFINE_STUB_XCHG(ByteSize, StubType, StubName) \ |
79 #define DEFINE_STUB_XCHG(ByteSize, StubType, StubName) \ |
80 template<> \ |
80 template<> \ |
81 template<typename T> \ |
81 template<typename T> \ |
82 inline T Atomic::PlatformXchg<ByteSize>::operator()(T exchange_value, \ |
82 inline T Atomic::PlatformXchg<ByteSize>::operator()(T volatile* dest, \ |
83 T volatile* dest, \ |
83 T exchange_value, \ |
84 atomic_memory_order order) const { \ |
84 atomic_memory_order order) const { \ |
85 STATIC_ASSERT(ByteSize == sizeof(T)); \ |
85 STATIC_ASSERT(ByteSize == sizeof(T)); \ |
86 return xchg_using_helper<StubType>(StubName, exchange_value, dest); \ |
86 return xchg_using_helper<StubType>(StubName, dest, exchange_value); \ |
87 } |
87 } |
88 |
88 |
89 DEFINE_STUB_XCHG(4, int32_t, os::atomic_xchg_func) |
89 DEFINE_STUB_XCHG(4, int32_t, os::atomic_xchg_func) |
90 DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func) |
90 DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func) |
91 |
91 |
125 } |
125 } |
126 } |
126 } |
127 |
127 |
128 template<> |
128 template<> |
129 template<typename T> |
129 template<typename T> |
130 inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, |
130 inline T Atomic::PlatformXchg<4>::operator()(T volatile* dest, |
131 T volatile* dest, |
131 T exchange_value, |
132 atomic_memory_order order) const { |
132 atomic_memory_order order) const { |
133 STATIC_ASSERT(4 == sizeof(T)); |
133 STATIC_ASSERT(4 == sizeof(T)); |
134 // alternative for InterlockedExchange |
134 // alternative for InterlockedExchange |
135 __asm { |
135 __asm { |
136 mov eax, exchange_value; |
136 mov eax, exchange_value; |