[compiler-rt] b3267bb - [NFC][msan] Split ThreadStart and Init
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 8 18:58:42 PST 2021
Author: Vitaly Buka
Date: 2021-11-08T18:58:33-08:00
New Revision: b3267bb3afd3c70a415ae81c855462affae92f6b
URL: https://github.com/llvm/llvm-project/commit/b3267bb3afd3c70a415ae81c855462affae92f6b
DIFF: https://github.com/llvm/llvm-project/commit/b3267bb3afd3c70a415ae81c855462affae92f6b.diff
LOG: [NFC][msan] Split ThreadStart and Init
Added:
Modified:
compiler-rt/lib/msan/msan.cpp
compiler-rt/lib/msan/msan_interceptors.cpp
compiler-rt/lib/msan/msan_thread.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp
index 1be4195e03494..c554a830e7552 100644
--- a/compiler-rt/lib/msan/msan.cpp
+++ b/compiler-rt/lib/msan/msan.cpp
@@ -470,7 +470,7 @@ void __msan_init() {
MsanThread *main_thread = MsanThread::Create(nullptr, nullptr);
SetCurrentThread(main_thread);
- main_thread->ThreadStart();
+ main_thread->Init();
#if MSAN_CONTAINS_UBSAN
__ubsan::InitAsPlugin();
diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp
index d485149350ee2..46bdfa0e84d5a 100644
--- a/compiler-rt/lib/msan/msan_interceptors.cpp
+++ b/compiler-rt/lib/msan/msan_interceptors.cpp
@@ -1033,6 +1033,7 @@ extern "C" int pthread_attr_destroy(void *attr);
static void *MsanThreadStartFunc(void *arg) {
MsanThread *t = (MsanThread *)arg;
SetCurrentThread(t);
+ t->Init();
return t->ThreadStart();
}
diff --git a/compiler-rt/lib/msan/msan_thread.cpp b/compiler-rt/lib/msan/msan_thread.cpp
index 6ae012acd9a2b..3bd34e2c1151e 100644
--- a/compiler-rt/lib/msan/msan_thread.cpp
+++ b/compiler-rt/lib/msan/msan_thread.cpp
@@ -65,20 +65,7 @@ void MsanThread::Destroy() {
DTLS_Destroy();
}
-thread_return_t MsanThread::ThreadStart() {
- Init();
-
- if (!start_routine_) {
- // start_routine_ == 0 if we're on the main thread or on one of the
- // OS X libdispatch worker threads. But nobody is supposed to call
- // ThreadStart() for the worker threads.
- return 0;
- }
-
- thread_return_t res = start_routine_(arg_);
-
- return res;
-}
+thread_return_t MsanThread::ThreadStart() { return start_routine_(arg_); }
MsanThread::StackBounds MsanThread::GetStackBounds() const {
if (!stack_switching_)
More information about the llvm-commits
mailing list