Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/hotspot/share/classfile/symbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions src/hotspot/share/runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -158,20 +155,16 @@ 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!");
}

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);
}

Expand Down
9 changes: 0 additions & 9 deletions src/hotspot/share/runtime/thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down