8230878: ZGC: Use THREAD_LOCAL instead of __thread

Reviewed-by: kbarrett
This commit is contained in:
Per Lidén 2019-09-13 08:40:09 +02:00
parent f3d8d57cd3
commit 17abb078fc
6 changed files with 23 additions and 20 deletions

View File

@ -33,8 +33,8 @@
#define ZCPU_UNKNOWN_SELF (Thread*)-2;
PaddedEnd<ZCPU::ZCPUAffinity>* 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");

View File

@ -26,6 +26,7 @@
#include "memory/allocation.hpp"
#include "memory/padded.hpp"
#include "utilities/globalDefinitions.hpp"
class Thread;
@ -36,8 +37,8 @@ private:
};
static PaddedEnd<ZCPUAffinity>* _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();

View File

@ -755,7 +755,7 @@ void ZStatCriticalPhase::register_end(const Ticks& start, const Ticks& end) cons
//
// Stat timer
//
__thread uint32_t ZStatTimerDisable::_active = 0;
THREAD_LOCAL uint32_t ZStatTimerDisable::_active = 0;
//
// Stat sample/inc

View File

@ -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 @@ public:
//
class ZStatTimerDisable : public StackObj {
private:
static __thread uint32_t _active;
static THREAD_LOCAL uint32_t _active;
public:
ZStatTimerDisable() {

View File

@ -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");

View File

@ -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 @@ class ZThread : public AllStatic {
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();