| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file is an internal atomic implementation for compiler-based | 5 // This file is an internal atomic implementation for compiler-based |
| 6 // ThreadSanitizer. Use base/atomicops.h instead. | 6 // ThreadSanitizer. Use base/atomicops.h instead. |
| 7 | 7 |
| 8 #ifndef BASE_ATOMICOPS_INTERNALS_TSAN_H_ | 8 #ifndef BASE_ATOMICOPS_INTERNALS_TSAN_H_ |
| 9 #define BASE_ATOMICOPS_INTERNALS_TSAN_H_ | 9 #define BASE_ATOMICOPS_INTERNALS_TSAN_H_ |
| 10 | 10 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 | 12 |
| 13 // This struct is not part of the public API of this module; clients may not | 13 // This struct is not part of the public API of this module; clients may not |
| 14 // use it. (However, it's exported via BASE_EXPORT because clients implicitly | 14 // use it. (However, it's exported via BASE_EXPORT because clients implicitly |
| 15 // do use it at link time by inlining these functions.) | 15 // do use it at link time by inlining these functions.) |
| 16 // Features of this x86. Values may not be correct before main() is run, | 16 // Features of this x86. Values may not be correct before main() is run, |
| 17 // but are set conservatively. | 17 // but are set conservatively. |
| 18 struct AtomicOps_x86CPUFeatureStruct { | 18 struct AtomicOps_x86CPUFeatureStruct { |
| 19 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence | 19 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence |
| 20 // after acquire compare-and-swap. | 20 // after acquire compare-and-swap. |
| 21 bool has_sse2; // Processor has SSE2. | |
| 22 }; | 21 }; |
| 23 BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct | 22 BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct |
| 24 AtomicOps_Internalx86CPUFeatures; | 23 AtomicOps_Internalx86CPUFeatures; |
| 25 | 24 |
| 26 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") | 25 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") |
| 27 | 26 |
| 28 #include <sanitizer/tsan_interface_atomic.h> | 27 #include <sanitizer/tsan_interface_atomic.h> |
| 29 | 28 |
| 30 namespace base { | 29 namespace base { |
| 31 namespace subtle { | 30 namespace subtle { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 inline void MemoryBarrier() { | 195 inline void MemoryBarrier() { |
| 197 __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); | 196 __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); |
| 198 } | 197 } |
| 199 | 198 |
| 200 } // namespace base::subtle | 199 } // namespace base::subtle |
| 201 } // namespace base | 200 } // namespace base |
| 202 | 201 |
| 203 #undef ATOMICOPS_COMPILER_BARRIER | 202 #undef ATOMICOPS_COMPILER_BARRIER |
| 204 | 203 |
| 205 #endif // BASE_ATOMICOPS_INTERNALS_TSAN_H_ | 204 #endif // BASE_ATOMICOPS_INTERNALS_TSAN_H_ |
| OLD | NEW |