[PATCH] D87478: scudo: Remove the THREADLOCAL macro.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 12:39:54 PDT 2020
pcc created this revision.
pcc added a reviewer: cryptoad.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
pcc requested review of this revision.
Replace all remaining uses with thread_local, which is a C++11
standard feature.
Depends on D87420 <https://reviews.llvm.org/D87420>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87478
Files:
compiler-rt/lib/scudo/standalone/internal_defs.h
compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
compiler-rt/lib/scudo/standalone/tsd_exclusive.h
Index: compiler-rt/lib/scudo/standalone/tsd_exclusive.h
===================================================================
--- compiler-rt/lib/scudo/standalone/tsd_exclusive.h
+++ compiler-rt/lib/scudo/standalone/tsd_exclusive.h
@@ -99,16 +99,16 @@
atomic_u8 Disabled;
TSD<Allocator> FallbackTSD;
HybridMutex Mutex;
- static THREADLOCAL ThreadState State;
- static THREADLOCAL TSD<Allocator> ThreadTSD;
+ static thread_local ThreadState State;
+ static thread_local TSD<Allocator> ThreadTSD;
friend void teardownThread<Allocator>(void *Ptr);
};
template <class Allocator>
-THREADLOCAL TSD<Allocator> TSDRegistryExT<Allocator>::ThreadTSD;
+thread_local TSD<Allocator> TSDRegistryExT<Allocator>::ThreadTSD;
template <class Allocator>
-THREADLOCAL ThreadState TSDRegistryExT<Allocator>::State;
+thread_local ThreadState TSDRegistryExT<Allocator>::State;
template <class Allocator> void teardownThread(void *Ptr) {
typedef TSDRegistryExT<Allocator> TSDRegistryT;
Index: compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
@@ -152,7 +152,7 @@
static bool Ready;
template <typename Primary> static void performAllocations(Primary *Allocator) {
- static THREADLOCAL typename Primary::CacheT Cache;
+ static thread_local typename Primary::CacheT Cache;
Cache.init(nullptr, Allocator);
std::vector<std::pair<scudo::uptr, void *>> V;
{
Index: compiler-rt/lib/scudo/standalone/internal_defs.h
===================================================================
--- compiler-rt/lib/scudo/standalone/internal_defs.h
+++ compiler-rt/lib/scudo/standalone/internal_defs.h
@@ -36,7 +36,6 @@
#define FORMAT(F, A) __attribute__((format(printf, F, A)))
#define NOINLINE __attribute__((noinline))
#define NORETURN __attribute__((noreturn))
-#define THREADLOCAL __thread
#define LIKELY(X) __builtin_expect(!!(X), 1)
#define UNLIKELY(X) __builtin_expect(!!(X), 0)
#if defined(__i386__) || defined(__x86_64__)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87478.291066.patch
Type: text/x-patch
Size: 2129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/c83af2a9/attachment.bin>
More information about the llvm-commits
mailing list