mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8356394: Remove USE_LIBRARY_BASED_TLS_ONLY macro
Reviewed-by: dholmes, kbarrett, lucy
This commit is contained in:
parent
591e71ebe5
commit
c88f94c9d7
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user