# HG changeset patch # User pliden # Date 1568356809 -7200 # Node ID 9b4717ca9bd16667b00c632ee1f3f397b4b580fb # Parent dc792fa77da0de5e93624900b71914b8e2e43077 8230878: ZGC: Use THREAD_LOCAL instead of __thread Reviewed-by: kbarrett diff -r dc792fa77da0 -r 9b4717ca9bd1 src/hotspot/share/gc/z/zCPU.cpp --- a/src/hotspot/share/gc/z/zCPU.cpp Fri Sep 13 08:40:09 2019 +0200 +++ b/src/hotspot/share/gc/z/zCPU.cpp Fri Sep 13 08:40:09 2019 +0200 @@ -33,8 +33,8 @@ #define ZCPU_UNKNOWN_SELF (Thread*)-2; PaddedEnd* ZCPU::_affinity = NULL; -__thread Thread* ZCPU::_self = ZCPU_UNKNOWN_SELF; -__thread uint32_t ZCPU::_cpu = 0; +THREAD_LOCAL Thread* ZCPU::_self = ZCPU_UNKNOWN_SELF; +THREAD_LOCAL uint32_t ZCPU::_cpu = 0; void ZCPU::initialize() { assert(_affinity == NULL, "Already initialized"); diff -r dc792fa77da0 -r 9b4717ca9bd1 src/hotspot/share/gc/z/zCPU.hpp --- a/src/hotspot/share/gc/z/zCPU.hpp Fri Sep 13 08:40:09 2019 +0200 +++ b/src/hotspot/share/gc/z/zCPU.hpp Fri Sep 13 08:40:09 2019 +0200 @@ -26,6 +26,7 @@ #include "memory/allocation.hpp" #include "memory/padded.hpp" +#include "utilities/globalDefinitions.hpp" class Thread; @@ -36,8 +37,8 @@ }; static PaddedEnd* _affinity; - static __thread Thread* _self; - static __thread uint32_t _cpu; + static THREAD_LOCAL Thread* _self; + static THREAD_LOCAL uint32_t _cpu; public: static void initialize(); diff -r dc792fa77da0 -r 9b4717ca9bd1 src/hotspot/share/gc/z/zStat.cpp --- a/src/hotspot/share/gc/z/zStat.cpp Fri Sep 13 08:40:09 2019 +0200 +++ b/src/hotspot/share/gc/z/zStat.cpp Fri Sep 13 08:40:09 2019 +0200 @@ -755,7 +755,7 @@ // // Stat timer // -__thread uint32_t ZStatTimerDisable::_active = 0; +THREAD_LOCAL uint32_t ZStatTimerDisable::_active = 0; // // Stat sample/inc diff -r dc792fa77da0 -r 9b4717ca9bd1 src/hotspot/share/gc/z/zStat.hpp --- a/src/hotspot/share/gc/z/zStat.hpp Fri Sep 13 08:40:09 2019 +0200 +++ b/src/hotspot/share/gc/z/zStat.hpp Fri Sep 13 08:40:09 2019 +0200 @@ -29,6 +29,7 @@ #include "gc/z/zMetronome.hpp" #include "logging/logHandle.hpp" #include "memory/allocation.hpp" +#include "utilities/globalDefinitions.hpp" #include "utilities/numberSeq.hpp" #include "utilities/ticks.hpp" @@ -271,7 +272,7 @@ // class ZStatTimerDisable : public StackObj { private: - static __thread uint32_t _active; + static THREAD_LOCAL uint32_t _active; public: ZStatTimerDisable() { diff -r dc792fa77da0 -r 9b4717ca9bd1 src/hotspot/share/gc/z/zThread.cpp --- a/src/hotspot/share/gc/z/zThread.cpp Fri Sep 13 08:40:09 2019 +0200 +++ b/src/hotspot/share/gc/z/zThread.cpp Fri Sep 13 08:40:09 2019 +0200 @@ -26,13 +26,13 @@ #include "runtime/thread.hpp" #include "utilities/debug.hpp" -__thread bool ZThread::_initialized; -__thread uintptr_t ZThread::_id; -__thread bool ZThread::_is_vm; -__thread bool ZThread::_is_java; -__thread bool ZThread::_is_worker; -__thread bool ZThread::_is_runtime_worker; -__thread uint ZThread::_worker_id; +THREAD_LOCAL bool ZThread::_initialized; +THREAD_LOCAL uintptr_t ZThread::_id; +THREAD_LOCAL bool ZThread::_is_vm; +THREAD_LOCAL bool ZThread::_is_java; +THREAD_LOCAL bool ZThread::_is_worker; +THREAD_LOCAL bool ZThread::_is_runtime_worker; +THREAD_LOCAL uint ZThread::_worker_id; void ZThread::initialize() { assert(!_initialized, "Already initialized"); diff -r dc792fa77da0 -r 9b4717ca9bd1 src/hotspot/share/gc/z/zThread.hpp --- a/src/hotspot/share/gc/z/zThread.hpp Fri Sep 13 08:40:09 2019 +0200 +++ b/src/hotspot/share/gc/z/zThread.hpp Fri Sep 13 08:40:09 2019 +0200 @@ -25,6 +25,7 @@ #define SHARE_GC_Z_ZTHREAD_HPP #include "memory/allocation.hpp" +#include "utilities/globalDefinitions.hpp" #include "utilities/debug.hpp" class ZThread : public AllStatic { @@ -33,13 +34,13 @@ friend class ZRuntimeWorkersInitializeTask; private: - static __thread bool _initialized; - static __thread uintptr_t _id; - static __thread bool _is_vm; - static __thread bool _is_java; - static __thread bool _is_worker; - static __thread bool _is_runtime_worker; - static __thread uint _worker_id; + static THREAD_LOCAL bool _initialized; + static THREAD_LOCAL uintptr_t _id; + static THREAD_LOCAL bool _is_vm; + static THREAD_LOCAL bool _is_java; + static THREAD_LOCAL bool _is_worker; + static THREAD_LOCAL bool _is_runtime_worker; + static THREAD_LOCAL uint _worker_id; static void initialize();