diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc index a3d8b32cdc3..d190c80eff7 100644 --- a/runtime/vm/os_thread.cc +++ b/runtime/vm/os_thread.cc @@ -20,9 +20,7 @@ OSThread* OSThread::thread_list_head_ = NULL; Mutex* OSThread::thread_list_lock_ = NULL; bool OSThread::creation_enabled_ = false; -#if defined(HAS_C11_THREAD_LOCAL) thread_local ThreadState* OSThread::current_vm_thread_ = NULL; -#endif OSThread::OSThread() : BaseThread(true), @@ -282,14 +280,12 @@ void OSThread::SetCurrentTLS(BaseThread* value) { // Provides thread-local destructors. SetThreadLocal(thread_key_, reinterpret_cast(value)); -#if defined(HAS_C11_THREAD_LOCAL) // Allows the C compiler more freedom to optimize. if ((value != NULL) && !value->is_os_thread()) { current_vm_thread_ = static_cast(value); } else { current_vm_thread_ = NULL; } -#endif } OSThreadIterator::OSThreadIterator() { diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h index 7601cdcc4d3..b1019e870ce 100644 --- a/runtime/vm/os_thread.h +++ b/runtime/vm/os_thread.h @@ -12,11 +12,6 @@ #include "vm/allocation.h" #include "vm/globals.h" -// On iOS, thread_local requires iOS 9+. -#if !DART_HOST_OS_IOS -#define HAS_C11_THREAD_LOCAL 1 -#endif - // Declare the OS-specific types ahead of defining the generic classes. #if defined(DART_HOST_OS_ANDROID) #include "vm/os_thread_android.h" @@ -182,9 +177,7 @@ class OSThread : public BaseThread { } static void SetCurrent(OSThread* current) { SetCurrentTLS(current); } -#if defined(HAS_C11_THREAD_LOCAL) static ThreadState* CurrentVMThread() { return current_vm_thread_; } -#endif // TODO(5411455): Use flag to override default value and Validate the // stack size by querying OS. @@ -308,9 +301,7 @@ class OSThread : public BaseThread { static OSThread* thread_list_head_; static bool creation_enabled_; -#if defined(HAS_C11_THREAD_LOCAL) static thread_local ThreadState* current_vm_thread_; -#endif friend class IsolateGroup; // to access set_thread(Thread*). friend class OSThreadIterator; diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h index d5f56ee1846..4277ee7610e 100644 --- a/runtime/vm/thread.h +++ b/runtime/vm/thread.h @@ -282,15 +282,7 @@ class Thread : public ThreadState { // The currently executing thread, or NULL if not yet initialized. static Thread* Current() { -#if defined(HAS_C11_THREAD_LOCAL) return static_cast(OSThread::CurrentVMThread()); -#else - BaseThread* thread = OSThread::GetCurrentTLS(); - if (thread == NULL || thread->is_os_thread()) { - return NULL; - } - return static_cast(thread); -#endif } // Makes the current thread enter 'isolate'. diff --git a/runtime/vm/thread_state.h b/runtime/vm/thread_state.h index 58e57aae94a..e83bc26f4d7 100644 --- a/runtime/vm/thread_state.h +++ b/runtime/vm/thread_state.h @@ -25,15 +25,7 @@ class ThreadState : public BaseThread { public: // The currently executing thread, or NULL if not yet initialized. static ThreadState* Current() { -#if defined(HAS_C11_THREAD_LOCAL) return OSThread::CurrentVMThread(); -#else - BaseThread* thread = OSThread::GetCurrentTLS(); - if (thread == NULL || thread->is_os_thread()) { - return NULL; - } - return static_cast(thread); -#endif } explicit ThreadState(bool is_os_thread);