changeset 56262:9b4717ca9bd1

8230878: ZGC: Use THREAD_LOCAL instead of __thread Reviewed-by: kbarrett
author pliden
date Fri, 13 Sep 2019 08:40:09 +0200
parents dc792fa77da0
children 1def54255e93
files src/hotspot/share/gc/z/zCPU.cpp src/hotspot/share/gc/z/zCPU.hpp src/hotspot/share/gc/z/zStat.cpp src/hotspot/share/gc/z/zStat.hpp src/hotspot/share/gc/z/zThread.cpp src/hotspot/share/gc/z/zThread.hpp
diffstat 6 files changed, 23 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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::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");
--- 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<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();
--- 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
--- 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() {
--- 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");
--- 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();