[PATCH] D14288: [tsan] Alternative ThreadState storage for OS X

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 09:14:38 PST 2015


dvyukov added a comment.

Looks much better now.

Waiting for the async-signal-safe change, and then we can get this in.


================
Comment at: lib/tsan/rtl/tsan_platform_mac.cc:59
@@ +58,3 @@
+  if (thread_identity == main_thread_identity || main_thread_identity == 0) {
+    if (main_thread_identity == 0) main_thread_identity = thread_identity;
+    fake_tls = &main_thread_state;
----------------
Move this in InitializePlatform.



================
Comment at: lib/tsan/rtl/tsan_platform_mac.cc:64
@@ +63,3 @@
+  }
+  if (*fake_tls == nullptr) {
+    *fake_tls = (ThreadState *)InternalAlloc(sizeof(ThreadState), nullptr);
----------------
Add UNLIKELY.

I know you are now concentrated on getting it to work end-to-end, but these are small things that do improve generated code.

================
Comment at: lib/tsan/rtl/tsan_rtl.h:423
@@ +422,3 @@
+#endif
+#if !SANITIZER_MAC
+INLINE void cur_thread_finalize() { }
----------------
This also needs to be !defined(SANITIZER_GO)

I think it's better to do:

#ifndef SANITIZER_GO

#if SANITIZER_MAC
...
#else
...
#endif

#endif



http://reviews.llvm.org/D14288





More information about the llvm-commits mailing list