From c715b8757bbabceaec48a0586f0509a7ac0d9a96 Mon Sep 17 00:00:00 2001 From: MBaesken Date: Wed, 7 May 2025 16:47:21 +0200 Subject: [PATCH] JDK-8356394 --- src/hotspot/share/classfile/symbolTable.cpp | 6 +----- src/hotspot/share/runtime/thread.cpp | 7 ------- src/hotspot/share/runtime/thread.hpp | 9 --------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index 1fd28a1d4e937..e6889e6248d60 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -88,13 +88,9 @@ static volatile bool _has_items_to_clean = false; static volatile bool _alt_hash = false; -#ifdef USE_LIBRARY_BASED_TLS_ONLY -static volatile bool _lookup_shared_first = false; -#else // "_lookup_shared_first" can get highly contended with many cores if multiple threads -// are updating "lookup success history" in a global shared variable. If built-in TLS is available, use it. +// are updating "lookup success history" in a global shared variable, so use built-in TLS static THREAD_LOCAL bool _lookup_shared_first = false; -#endif // Static arena for symbols that are not deallocated Arena* SymbolTable::_arena = nullptr; diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index 400d69ad510a3..0d245dae857c1 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -52,10 +52,7 @@ #include "jfr/jfr.hpp" #endif -#ifndef USE_LIBRARY_BASED_TLS_ONLY -// Current thread is maintained as a thread-local variable THREAD_LOCAL Thread* Thread::_thr_current = nullptr; -#endif // ======= Thread ======== // Base class for all threads: VMThread, WatcherThread, ConcurrentMarkSweepThread, @@ -158,10 +155,8 @@ void Thread::initialize_tlab() { } void Thread::initialize_thread_current() { -#ifndef USE_LIBRARY_BASED_TLS_ONLY assert(_thr_current == nullptr, "Thread::current already initialized"); _thr_current = this; -#endif assert(ThreadLocalStorage::thread() == nullptr, "ThreadLocalStorage::thread already initialized"); ThreadLocalStorage::set_thread(this); assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!"); @@ -169,9 +164,7 @@ void Thread::initialize_thread_current() { void Thread::clear_thread_current() { assert(Thread::current() == ThreadLocalStorage::thread(), "TLS mismatch!"); -#ifndef USE_LIBRARY_BASED_TLS_ONLY _thr_current = nullptr; -#endif ThreadLocalStorage::set_thread(nullptr); } diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 81307c4acab42..7ab86121b89ac 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -113,10 +113,8 @@ class Thread: public ThreadShadow { friend class JavaThread; private: -#ifndef USE_LIBRARY_BASED_TLS_ONLY // Current thread is maintained as a thread-local variable static THREAD_LOCAL Thread* _thr_current; -#endif // On AArch64, the high order 32 bits are used by a "patching epoch" number // which reflects if this thread has executed the required fences, after @@ -660,14 +658,7 @@ inline Thread* Thread::current() { } inline Thread* Thread::current_or_null() { -#ifndef USE_LIBRARY_BASED_TLS_ONLY return _thr_current; -#else - if (ThreadLocalStorage::is_initialized()) { - return ThreadLocalStorage::thread(); - } - return nullptr; -#endif } inline Thread* Thread::current_or_null_safe() {