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