@@ -50,15 +50,19 @@ class NonJavaThread::List {
5050 List () : _head(nullptr ), _protect() {}
5151};
5252
53- NonJavaThread::List NonJavaThread::_the_list;
53+ DeferredStatic<NonJavaThread::List> NonJavaThread::_the_list;
54+
55+ void NonJavaThread::init () {
56+ _the_list.initialize ();
57+ }
5458
5559NonJavaThread::Iterator::Iterator () :
56- _protect_enter(_the_list. _protect.enter()),
57- _current(AtomicAccess::load_acquire(&_the_list. _head))
60+ _protect_enter(_the_list-> _protect.enter()),
61+ _current(AtomicAccess::load_acquire(&_the_list-> _head))
5862{}
5963
6064NonJavaThread::Iterator::~Iterator () {
61- _the_list. _protect .exit (_protect_enter);
65+ _the_list-> _protect .exit (_protect_enter);
6266}
6367
6468void NonJavaThread::Iterator::step () {
@@ -76,16 +80,16 @@ void NonJavaThread::add_to_the_list() {
7680 MutexLocker ml (NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
7781 // Initialize BarrierSet-related data before adding to list.
7882 BarrierSet::barrier_set ()->on_thread_attach (this );
79- AtomicAccess::release_store (&_next, _the_list. _head );
80- AtomicAccess::release_store (&_the_list. _head , this );
83+ AtomicAccess::release_store (&_next, _the_list-> _head );
84+ AtomicAccess::release_store (&_the_list-> _head , this );
8185}
8286
8387void NonJavaThread::remove_from_the_list () {
8488 {
8589 MutexLocker ml (NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
8690 // Cleanup BarrierSet-related data before removing from list.
8791 BarrierSet::barrier_set ()->on_thread_detach (this );
88- NonJavaThread* volatile * p = &_the_list. _head ;
92+ NonJavaThread* volatile * p = &_the_list-> _head ;
8993 for (NonJavaThread* t = *p; t != nullptr ; p = &t->_next , t = *p) {
9094 if (t == this ) {
9195 *p = _next;
@@ -97,7 +101,7 @@ void NonJavaThread::remove_from_the_list() {
97101 // allowed, so do it while holding a dedicated lock. Outside and distinct
98102 // from NJTList_lock in case an iteration attempts to lock it.
99103 MutexLocker ml (NonJavaThreadsListSync_lock, Mutex::_no_safepoint_check_flag);
100- _the_list. _protect .synchronize ();
104+ _the_list-> _protect .synchronize ();
101105 _next = nullptr ; // Safe to drop the link now.
102106}
103107
@@ -344,4 +348,3 @@ void WatcherThread::print_on(outputStream* st) const {
344348 Thread::print_on (st);
345349 st->cr ();
346350}
347-
0 commit comments