|
56 | 56 | static int runOnTsan;
|
57 | 57 | static int hasReductionCallback;
|
58 | 58 |
|
| 59 | +namespace { |
59 | 60 | class ArcherFlags {
|
60 | 61 | public:
|
61 | 62 | #if (LLVM_VERSION) >= 40
|
@@ -132,14 +133,15 @@ class TsanFlags {
|
132 | 133 | }
|
133 | 134 | }
|
134 | 135 | };
|
| 136 | +} // namespace |
135 | 137 |
|
136 | 138 | #if (LLVM_VERSION) >= 40
|
137 | 139 | extern "C" {
|
138 | 140 | int __attribute__((weak)) __archer_get_omp_status();
|
139 | 141 | void __attribute__((weak)) __tsan_flush_memory() {}
|
140 | 142 | }
|
141 | 143 | #endif
|
142 |
| -ArcherFlags *archer_flags; |
| 144 | +static ArcherFlags *archer_flags; |
143 | 145 |
|
144 | 146 | #ifndef TsanHappensBefore
|
145 | 147 | // Thread Sanitizer is a tool that finds races in code.
|
@@ -232,6 +234,7 @@ static int pagesize{0};
|
232 | 234 |
|
233 | 235 | // Data structure to provide a threadsafe pool of reusable objects.
|
234 | 236 | // DataPool<Type of objects>
|
| 237 | +namespace { |
235 | 238 | template <typename T> struct DataPool final {
|
236 | 239 | static __thread DataPool<T> *ThreadDataPool;
|
237 | 240 | std::mutex DPMutex{};
|
@@ -598,14 +601,15 @@ struct TaskData final : DataPoolEntry<TaskData> {
|
598 | 601 |
|
599 | 602 | TaskData(DataPool<TaskData> *dp) : DataPoolEntry<TaskData>(dp) {}
|
600 | 603 | };
|
| 604 | +} // namespace |
601 | 605 |
|
602 | 606 | static inline TaskData *ToTaskData(ompt_data_t *task_data) {
|
603 | 607 | return reinterpret_cast<TaskData *>(task_data->ptr);
|
604 | 608 | }
|
605 | 609 |
|
606 | 610 | /// Store a mutex for each wait_id to resolve race condition with callbacks.
|
607 |
| -std::unordered_map<ompt_wait_id_t, std::mutex> Locks; |
608 |
| -std::mutex LocksMutex; |
| 611 | +static std::unordered_map<ompt_wait_id_t, std::mutex> Locks; |
| 612 | +static std::mutex LocksMutex; |
609 | 613 |
|
610 | 614 | static void ompt_tsan_thread_begin(ompt_thread_t thread_type,
|
611 | 615 | ompt_data_t *thread_data) {
|
|
0 commit comments