[PATCH] tsan: find races between atomic and plain memory accesses

Dmitry Vyukov dvyukov at google.com
Fri Feb 1 01:44:13 PST 2013


  committed as 174163.


================
Comment at: tsan/rtl/tsan_rtl.h:267
@@ -252,2 +266,3 @@
   u64 size() const { return 1ull << size_log(); }
   bool is_write() const { return x_ & 32; }
+  bool IsWrite() const { return x_ & 32; }
----------------
Kostya Serebryany wrote:
> do we want to have both is_write and IsWrite?
Done

================
Comment at: tsan/rtl/tsan_rtl.h:312
@@ -274,1 +311,3 @@
  private:
+  static const u64 kAtomicBit = 1ull << 6;
+
----------------
Kostya Serebryany wrote:
> you have kAtomicBit, but you are still using 5 and 6 in functions above.
> Maybe have kAtomicAndWriteBits? 
Done

================
Comment at: tsan/rtl/tsan_interface_inl.h:22
@@ -21,3 +21,3 @@
 void __tsan_read1(void *addr) {
-  MemoryAccess(cur_thread(), CALLERPC, (uptr)addr, 0, 0);
+  MemoryAccess(cur_thread(), CALLERPC, (uptr)addr, 0, 0, 0);
 }
----------------
Kostya Serebryany wrote:
> why do we have 1/0 instead of true/false?
> maybe it's better to use enums with descriptive names here?
> or 4 functions? 
Done
I've introduced MemoryRead/MemoryWrite/MemoryReadAtomic/MemoryWriteAtomic and size constants kSizeLog1/2/4/8.


http://llvm-reviews.chandlerc.com/D357



More information about the llvm-commits mailing list