[compiler-rt] 07edc1c - [NFC][sanitizer] Rename *ThreadRegistry functions

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 18:34:28 PDT 2023


Author: Vitaly Buka
Date: 2023-05-24T18:34:14-07:00
New Revision: 07edc1c16faa501cd3d36b8196b314dc55c71b1e

URL: https://github.com/llvm/llvm-project/commit/07edc1c16faa501cd3d36b8196b314dc55c71b1e
DIFF: https://github.com/llvm/llvm-project/commit/07edc1c16faa501cd3d36b8196b314dc55c71b1e.diff

LOG: [NFC][sanitizer] Rename *ThreadRegistry functions

Reviewed By: thurston

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

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_thread.cpp
    compiler-rt/lib/hwasan/hwasan_thread.cpp
    compiler-rt/lib/lsan/lsan.cpp
    compiler-rt/lib/lsan/lsan_common.h
    compiler-rt/lib/lsan/lsan_thread.cpp
    compiler-rt/lib/lsan/lsan_thread.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 343fd079fa025..f718adf5e1f73 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -494,12 +494,12 @@ __asan::AsanThread *GetAsanThreadByOsIDLocked(tid_t os_id) {
 
 // --- Implementation of LSan-specific functions --- {{{1
 namespace __lsan {
-void LockThreadRegistry() {
+void LockThreads() {
   __asan::asanThreadRegistry().Lock();
   __asan::asanThreadArgRetval().Lock();
 }
 
-void UnlockThreadRegistry() {
+void UnlockThreads() {
   __asan::asanThreadArgRetval().Unlock();
   __asan::asanThreadRegistry().Unlock();
 }

diff  --git a/compiler-rt/lib/hwasan/hwasan_thread.cpp b/compiler-rt/lib/hwasan/hwasan_thread.cpp
index f5eb79f074f07..c4ab091d956c5 100644
--- a/compiler-rt/lib/hwasan/hwasan_thread.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_thread.cpp
@@ -174,12 +174,12 @@ static __hwasan::Thread *GetThreadByOsIDLocked(tid_t os_id) {
       [os_id](__hwasan::Thread *t) { return t->os_id() == os_id; });
 }
 
-void LockThreadRegistry() {
+void LockThreads() {
   __hwasan::hwasanThreadList().Lock();
   __hwasan::hwasanThreadArgRetval().Lock();
 }
 
-void UnlockThreadRegistry() {
+void UnlockThreads() {
   __hwasan::hwasanThreadArgRetval().Unlock();
   __hwasan::hwasanThreadList().Unlock();
 }

diff  --git a/compiler-rt/lib/lsan/lsan.cpp b/compiler-rt/lib/lsan/lsan.cpp
index 319f399e60f5d..6b223603c6a79 100644
--- a/compiler-rt/lib/lsan/lsan.cpp
+++ b/compiler-rt/lib/lsan/lsan.cpp
@@ -97,7 +97,7 @@ extern "C" void __lsan_init() {
   ReplaceSystemMalloc();
   InitTlsSize();
   InitializeInterceptors();
-  InitializeThreadRegistry();
+  InitializeThreads();
   InstallDeadlySignalHandlers(LsanOnDeadlySignal);
   InitializeMainThread();
   InstallAtExitCheckLeaks();

diff  --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h
index a1f2d1a349bcc..2c49bb6500967 100644
--- a/compiler-rt/lib/lsan/lsan_common.h
+++ b/compiler-rt/lib/lsan/lsan_common.h
@@ -96,8 +96,8 @@ bool WordIsPoisoned(uptr addr);
 //// --------------------------------------------------------------------------
 
 // Wrappers for ThreadRegistry access.
-void LockThreadRegistry() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
-void UnlockThreadRegistry() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
+void LockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
+void UnlockThreads() SANITIZER_NO_THREAD_SAFETY_ANALYSIS;
 // If called from the main thread, updates the main thread's TID in the thread
 // registry. We need this to handle processes that fork() without a subsequent
 // exec(), which invalidates the recorded TID. To update it, we must call
@@ -160,13 +160,13 @@ IgnoreObjectResult IgnoreObject(const void *p);
 
 struct ScopedStopTheWorldLock {
   ScopedStopTheWorldLock() {
-    LockThreadRegistry();
+    LockThreads();
     LockAllocator();
   }
 
   ~ScopedStopTheWorldLock() {
     UnlockAllocator();
-    UnlockThreadRegistry();
+    UnlockThreads();
   }
 
   ScopedStopTheWorldLock &operator=(const ScopedStopTheWorldLock &) = delete;

diff  --git a/compiler-rt/lib/lsan/lsan_thread.cpp b/compiler-rt/lib/lsan/lsan_thread.cpp
index 6dd9691afcf50..8aa3111eecf7d 100644
--- a/compiler-rt/lib/lsan/lsan_thread.cpp
+++ b/compiler-rt/lib/lsan/lsan_thread.cpp
@@ -34,7 +34,7 @@ static ThreadContextBase *CreateThreadContext(u32 tid) {
   return new (allocator_for_thread_context) ThreadContext(tid);
 }
 
-void InitializeThreadRegistry() {
+void InitializeThreads() {
   static ALIGNED(alignof(
       ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
   thread_registry =
@@ -83,12 +83,12 @@ void GetThreadExtraStackRangesLocked(tid_t os_id,
                                      InternalMmapVector<Range> *ranges) {}
 void GetThreadExtraStackRangesLocked(InternalMmapVector<Range> *ranges) {}
 
-void LockThreadRegistry() {
+void LockThreads() {
   thread_registry->Lock();
   thread_arg_retval->Lock();
 }
 
-void UnlockThreadRegistry() {
+void UnlockThreads() {
   thread_arg_retval->Unlock();
   thread_registry->Unlock();
 }

diff  --git a/compiler-rt/lib/lsan/lsan_thread.h b/compiler-rt/lib/lsan/lsan_thread.h
index afe83fb93401f..222066ee93cd9 100644
--- a/compiler-rt/lib/lsan/lsan_thread.h
+++ b/compiler-rt/lib/lsan/lsan_thread.h
@@ -44,7 +44,7 @@ class ThreadContextLsanBase : public ThreadContextBase {
 // This subclass of ThreadContextLsanBase is declared in an OS-specific header.
 class ThreadContext;
 
-void InitializeThreadRegistry();
+void InitializeThreads();
 void InitializeMainThread();
 
 ThreadRegistry *GetLsanThreadRegistryLocked();


        


More information about the llvm-commits mailing list