// As per atomic.hpp all read-modify-write operations have to provide two-way // barriers semantics. // // For ARMv7 we add explicit barriers in the stubs.
template<size_t byte_size> struct Atomic::PlatformAdd { template<typename D, typename I>
D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const;
// The memory_order parameter is ignored - we always provide the strongest/most-conservative ordering
// No direct support for cmpxchg of bytes; emulate using int. template<> struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {};
inline int32_t reorder_cmpxchg_func(int32_t exchange_value,
int32_t volatile* dest,
int32_t compare_value) { // Warning: Arguments are swapped to avoid moving them for kernel call return (*ARMAtomicFuncs::_cmpxchg_func)(compare_value, exchange_value, dest);
}
inline int64_t reorder_cmpxchg_long_func(int64_t exchange_value,
int64_t volatile* dest,
int64_t compare_value) {
assert(VM_Version::supports_cx8(), "Atomic compare and exchange int64_t not supported on this architecture!"); // Warning: Arguments are swapped to avoid moving them for kernel call return (*ARMAtomicFuncs::_cmpxchg_long_func)(compare_value, exchange_value, dest);
}
template<> template<typename T> inline T Atomic::PlatformCmpxchg<4>::operator()(T volatile* dest,
T compare_value,
T exchange_value,
atomic_memory_order order) const {
STATIC_ASSERT(4 == sizeof(T)); return cmpxchg_using_helper<int32_t>(reorder_cmpxchg_func, dest, compare_value, exchange_value);
}
template<> template<typename T> inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest,
T compare_value,
T exchange_value,
atomic_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T)); return cmpxchg_using_helper<int64_t>(reorder_cmpxchg_long_func, dest, compare_value, exchange_value);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.