33 34 // Implementation of class OrderAccess. 35 36 inline void OrderAccess::loadload() { acquire(); } 37 inline void OrderAccess::storestore() { release(); } 38 inline void OrderAccess::loadstore() { acquire(); } 39 inline void OrderAccess::storeload() { fence(); } 40 41 inline void OrderAccess::acquire() { 42 READ_MEM_BARRIER; 43 } 44 45 inline void OrderAccess::release() { 46 WRITE_MEM_BARRIER; 47 } 48 49 inline void OrderAccess::fence() { 50 FULL_MEM_BARRIER; 51 } 52 53 template<size_t byte_size> 54 struct OrderAccess::PlatformLoadAcquire<byte_size> { 55 template <typename T> 56 T operator()(volatile T* p) const { T data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } 57 }; 58 59 template<size_t byte_size> 60 struct OrderAccess::PlatformReleaseStore<byte_size> { 61 template <typename T> 62 void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } 63 }; 64 65 template<size_t byte_size> 66 struct OrderAccess::PlatformReleaseStoreFence<byte_size> { 67 template <typename T> 68 void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } 69 }; 70 71 #endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP | 33 34 // Implementation of class OrderAccess. 35 36 inline void OrderAccess::loadload() { acquire(); } 37 inline void OrderAccess::storestore() { release(); } 38 inline void OrderAccess::loadstore() { acquire(); } 39 inline void OrderAccess::storeload() { fence(); } 40 41 inline void OrderAccess::acquire() { 42 READ_MEM_BARRIER; 43 } 44 45 inline void OrderAccess::release() { 46 WRITE_MEM_BARRIER; 47 } 48 49 inline void OrderAccess::fence() { 50 FULL_MEM_BARRIER; 51 } 52 53 template<> 54 struct OrderAccess::PlatformLoadAcquire<1> VALUE_OBJ_CLASS_SPEC { 55 template <typename T> 56 T operator()(volatile T* p) const { T data = 0; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } 57 }; 58 template<> 59 struct OrderAccess::PlatformLoadAcquire<2> VALUE_OBJ_CLASS_SPEC { 60 template <typename T> 61 T operator()(volatile T* p) const { T data = 0; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } 62 }; 63 template<> 64 struct OrderAccess::PlatformLoadAcquire<4> VALUE_OBJ_CLASS_SPEC { 65 template <typename T> 66 T operator()(volatile T* p) const { T data = 0; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } 67 }; 68 template<> 69 struct OrderAccess::PlatformLoadAcquire<8> VALUE_OBJ_CLASS_SPEC { 70 template <typename T> 71 T operator()(volatile T* p) const { T data = 0; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } 72 }; 73 74 template<> 75 struct OrderAccess::PlatformReleaseStore<1> VALUE_OBJ_CLASS_SPEC { 76 template <typename T> 77 void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } 78 }; 79 template<> 80 struct OrderAccess::PlatformReleaseStore<2> VALUE_OBJ_CLASS_SPEC { 81 template <typename T> 82 void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } 83 }; 84 template<> 85 struct OrderAccess::PlatformReleaseStore<4> VALUE_OBJ_CLASS_SPEC { 86 template <typename T> 87 void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } 88 }; 89 template<> 90 struct OrderAccess::PlatformReleaseStore<8> VALUE_OBJ_CLASS_SPEC { 91 template <typename T> 92 void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } 93 }; 94 95 template<> 96 struct OrderAccess::PlatformReleaseStoreFence<1> VALUE_OBJ_CLASS_SPEC { 97 template <typename T> 98 void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } 99 }; 100 template<> 101 struct OrderAccess::PlatformReleaseStoreFence<2> VALUE_OBJ_CLASS_SPEC { 102 template <typename T> 103 void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } 104 }; 105 template<> 106 struct OrderAccess::PlatformReleaseStoreFence<4> VALUE_OBJ_CLASS_SPEC { 107 template <typename T> 108 void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } 109 }; 110 template<> 111 struct OrderAccess::PlatformReleaseStoreFence<8> VALUE_OBJ_CLASS_SPEC { 112 template <typename T> 113 void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } 114 }; 115 116 #endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP |