[compiler-rt] 7b51961 - [scudo][standalone] Remove the pthread key from the shared TSD

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 08:25:40 PDT 2020


Author: Kostya Kortchinsky
Date: 2020-09-22T08:25:27-07:00
New Revision: 7b51961cd0748ed5bd3b6fdacbfe596c374c93bc

URL: https://github.com/llvm/llvm-project/commit/7b51961cd0748ed5bd3b6fdacbfe596c374c93bc
DIFF: https://github.com/llvm/llvm-project/commit/7b51961cd0748ed5bd3b6fdacbfe596c374c93bc.diff

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

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.

Differential Revision: https://reviews.llvm.org/D88046

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h
index 2cacfde859b0..6a68b3ef5453 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -26,7 +26,6 @@ template <class Allocator, u32 TSDsArraySize, u32 DefaultTSDCount>
 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 @@ struct TSDRegistrySharedT {
     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 @@ struct TSDRegistrySharedT {
     return CurrentTSD;
   }
 
-  pthread_key_t PThreadKey;
   atomic_u32 CurrentIndex;
   u32 NumberOfTSDs;
   u32 NumberOfCoPrimes;


        


More information about the llvm-commits mailing list