[PATCH] D88046: [scudo][standalone] Remove the pthread key from the shared TSD

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 14:11:34 PDT 2020


cryptoad created this revision.
cryptoad added reviewers: pcc, hctim, eugenis, russell.gallop, cferris.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
cryptoad requested review of this revision.

https://reviews.llvm.org/D87420 removed the uses of the pthread key,
but the key itself was left in the shared TSD registry. It is created
on registry initialization, and destroyed on registry teardown.

There is really no use for it now, so we can just remove it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88046

Files:
  compiler-rt/lib/scudo/standalone/tsd_shared.h


Index: compiler-rt/lib/scudo/standalone/tsd_shared.h
===================================================================
--- compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -26,7 +26,6 @@
 struct TSDRegistrySharedT {
   void initLinkerInitialized(Allocator *Instance) {
     Instance->initLinkerInitialized();
-    CHECK_EQ(pthread_key_create(&PThreadKey, nullptr), 0); // For non-TLS
     for (u32 I = 0; I < TSDsArraySize; I++)
       TSDs[I].initLinkerInitialized(Instance);
     const u32 NumberOfCPUs = getNumberOfCPUs();
@@ -39,10 +38,7 @@
     initLinkerInitialized(Instance);
   }
 
-  void unmapTestOnly() {
-    setCurrentTSD(nullptr);
-    pthread_key_delete(PThreadKey);
-  }
+  void unmapTestOnly() { setCurrentTSD(nullptr); }
 
   ALWAYS_INLINE void initThreadMaybe(Allocator *Instance,
                                      UNUSED bool MinimalInit) {
@@ -201,7 +197,6 @@
     return CurrentTSD;
   }
 
-  pthread_key_t PThreadKey;
   atomic_u32 CurrentIndex;
   u32 NumberOfTSDs;
   u32 NumberOfCoPrimes;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88046.293251.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200921/f2a35b43/attachment.bin>


More information about the llvm-commits mailing list