15 #ifndef TSAN_ANNOTATIONS_H
16 #define TSAN_ANNOTATIONS_H
18 #include "kmp_config.h"
21 typedef unsigned long uptr;
22 typedef signed long sptr;
29 void AnnotateHappensBefore(
const char *f,
int l, uptr addr);
30 void AnnotateHappensAfter(
const char *f,
int l, uptr addr);
31 void AnnotateCondVarSignal(
const char *f,
int l, uptr cv);
32 void AnnotateCondVarSignalAll(
const char *f,
int l, uptr cv);
33 void AnnotateMutexIsNotPHB(
const char *f,
int l, uptr mu);
34 void AnnotateCondVarWait(
const char *f,
int l, uptr cv, uptr lock);
35 void AnnotateRWLockCreate(
const char *f,
int l, uptr m);
36 void AnnotateRWLockCreateStatic(
const char *f,
int l, uptr m);
37 void AnnotateRWLockDestroy(
const char *f,
int l, uptr m);
38 void AnnotateRWLockAcquired(
const char *f,
int l, uptr m, uptr is_w);
39 void AnnotateRWLockReleased(
const char *f,
int l, uptr m, uptr is_w);
40 void AnnotateTraceMemory(
const char *f,
int l, uptr mem);
41 void AnnotateFlushState(
const char *f,
int l);
42 void AnnotateNewMemory(
const char *f,
int l, uptr mem, uptr size);
43 void AnnotateNoOp(
const char *f,
int l, uptr mem);
44 void AnnotateFlushExpectedRaces(
const char *f,
int l);
45 void AnnotateEnableRaceDetection(
const char *f,
int l,
int enable);
46 void AnnotateMutexIsUsedAsCondVar(
const char *f,
int l, uptr mu);
47 void AnnotatePCQGet(
const char *f,
int l, uptr pcq);
48 void AnnotatePCQPut(
const char *f,
int l, uptr pcq);
49 void AnnotatePCQDestroy(
const char *f,
int l, uptr pcq);
50 void AnnotatePCQCreate(
const char *f,
int l, uptr pcq);
51 void AnnotateExpectRace(
const char *f,
int l, uptr mem,
char *desc);
52 void AnnotateBenignRaceSized(
const char *f,
int l, uptr mem, uptr size,
54 void AnnotateBenignRace(
const char *f,
int l, uptr mem,
char *desc);
55 void AnnotateIgnoreReadsBegin(
const char *f,
int l);
56 void AnnotateIgnoreReadsEnd(
const char *f,
int l);
57 void AnnotateIgnoreWritesBegin(
const char *f,
int l);
58 void AnnotateIgnoreWritesEnd(
const char *f,
int l);
59 void AnnotateIgnoreSyncBegin(
const char *f,
int l);
60 void AnnotateIgnoreSyncEnd(
const char *f,
int l);
61 void AnnotatePublishMemoryRange(
const char *f,
int l, uptr addr, uptr size);
62 void AnnotateUnpublishMemoryRange(
const char *f,
int l, uptr addr, uptr size);
63 void AnnotateThreadName(
const char *f,
int l,
char *name);
64 void WTFAnnotateHappensBefore(
const char *f,
int l, uptr addr);
65 void WTFAnnotateHappensAfter(
const char *f,
int l, uptr addr);
66 void WTFAnnotateBenignRaceSized(
const char *f,
int l, uptr mem, uptr sz,
68 int RunningOnValgrind();
69 double ValgrindSlowdown(
void);
70 const char *ThreadSanitizerQuery(
const char *query);
71 void AnnotateMemoryIsInitialized(
const char *f,
int l, uptr mem, uptr sz);
78 #define ANNOTATE_HAPPENS_AFTER(addr) \
79 AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
80 #define ANNOTATE_HAPPENS_BEFORE(addr) \
81 AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
82 #define ANNOTATE_IGNORE_WRITES_BEGIN() \
83 AnnotateIgnoreWritesBegin(__FILE__, __LINE__)
84 #define ANNOTATE_IGNORE_WRITES_END() AnnotateIgnoreWritesEnd(__FILE__, __LINE__)
85 #define ANNOTATE_RWLOCK_CREATE(lck) \
86 AnnotateRWLockCreate(__FILE__, __LINE__, (uptr)lck)
87 #define ANNOTATE_RWLOCK_RELEASED(lck) \
88 AnnotateRWLockAcquired(__FILE__, __LINE__, (uptr)lck, 1)
89 #define ANNOTATE_RWLOCK_ACQUIRED(lck) \
90 AnnotateRWLockReleased(__FILE__, __LINE__, (uptr)lck, 1)
91 #define ANNOTATE_BARRIER_BEGIN(addr) \
92 AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
93 #define ANNOTATE_BARRIER_END(addr) \
94 AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
95 #define ANNOTATE_REDUCE_AFTER(addr) \
96 AnnotateHappensAfter(__FILE__, __LINE__, (uptr)addr)
97 #define ANNOTATE_REDUCE_BEFORE(addr) \
98 AnnotateHappensBefore(__FILE__, __LINE__, (uptr)addr)
100 #define ANNOTATE_HAPPENS_AFTER(addr)
101 #define ANNOTATE_HAPPENS_BEFORE(addr)
102 #define ANNOTATE_IGNORE_WRITES_BEGIN()
103 #define ANNOTATE_IGNORE_WRITES_END()
104 #define ANNOTATE_RWLOCK_CREATE(lck)
105 #define ANNOTATE_RWLOCK_RELEASED(lck)
106 #define ANNOTATE_RWLOCK_ACQUIRED(lck)
107 #define ANNOTATE_BARRIER_BEGIN(addr)
108 #define ANNOTATE_BARRIER_END(addr)
109 #define ANNOTATE_REDUCE_AFTER(addr)
110 #define ANNOTATE_REDUCE_BEFORE(addr)
113 #define ANNOTATE_QUEUING
114 #define ANNOTATE_TICKET
115 #define ANNOTATE_FUTEX
117 #define ANNOTATE_DRDPA
119 #ifdef ANNOTATE_QUEUING
120 #define ANNOTATE_QUEUING_CREATE(lck)
121 #define ANNOTATE_QUEUING_RELEASED(lck) ANNOTATE_HAPPENS_BEFORE(lck)
122 #define ANNOTATE_QUEUING_ACQUIRED(lck) ANNOTATE_HAPPENS_AFTER(lck)
124 #define ANNOTATE_QUEUING_CREATE(lck)
125 #define ANNOTATE_QUEUING_RELEASED(lck)
126 #define ANNOTATE_QUEUING_ACQUIRED(lck)
129 #ifdef ANNOTATE_TICKET
130 #define ANNOTATE_TICKET_CREATE(lck)
131 #define ANNOTATE_TICKET_RELEASED(lck) ANNOTATE_HAPPENS_BEFORE(lck)
132 #define ANNOTATE_TICKET_ACQUIRED(lck) ANNOTATE_HAPPENS_AFTER(lck)
134 #define ANNOTATE_TICKET_CREATE(lck)
135 #define ANNOTATE_TICKET_RELEASED(lck)
136 #define ANNOTATE_TICKET_ACQUIRED(lck)
139 #ifdef ANNOTATE_FUTEX
140 #define ANNOTATE_FUTEX_CREATE(lck)
141 #define ANNOTATE_FUTEX_RELEASED(lck) ANNOTATE_HAPPENS_BEFORE(lck)
142 #define ANNOTATE_FUTEX_ACQUIRED(lck) ANNOTATE_HAPPENS_AFTER(lck)
144 #define ANNOTATE_FUTEX_CREATE(lck)
145 #define ANNOTATE_FUTEX_RELEASED(lck)
146 #define ANNOTATE_FUTEX_ACQUIRED(lck)
150 #define ANNOTATE_TAS_CREATE(lck)
151 #define ANNOTATE_TAS_RELEASED(lck) ANNOTATE_HAPPENS_BEFORE(lck)
152 #define ANNOTATE_TAS_ACQUIRED(lck) ANNOTATE_HAPPENS_AFTER(lck)
154 #define ANNOTATE_TAS_CREATE(lck)
155 #define ANNOTATE_TAS_RELEASED(lck)
156 #define ANNOTATE_TAS_ACQUIRED(lck)
159 #ifdef ANNOTATE_DRDPA
160 #define ANNOTATE_DRDPA_CREATE(lck)
161 #define ANNOTATE_DRDPA_RELEASED(lck) ANNOTATE_HAPPENS_BEFORE(lck)
162 #define ANNOTATE_DRDPA_ACQUIRED(lck) ANNOTATE_HAPPENS_AFTER(lck)
164 #define ANNOTATE_DRDPA_CREATE(lck)
165 #define ANNOTATE_DRDPA_RELEASED(lck)
166 #define ANNOTATE_DRDPA_ACQUIRED(lck)