diff -r 3198179d97fa -r 56309b1b9d9b src/hotspot/share/runtime/thread.cpp --- a/src/hotspot/share/runtime/thread.cpp Thu Aug 30 16:33:14 2018 -0400 +++ b/src/hotspot/share/runtime/thread.cpp Thu Aug 30 17:03:46 2018 -0400 @@ -307,13 +307,15 @@ } #endif // ASSERT - // Notify the barrier set that a thread is being created. Note that the - // main thread is created before a barrier set is available. The call to - // BarrierSet::on_thread_create() for the main thread is therefore deferred - // until it calls BarrierSet::set_barrier_set(). + // Notify the barrier set that a thread is being created. Note that some + // threads are created before a barrier set is available. The call to + // BarrierSet::on_thread_create() for these threads is therefore deferred + // to BarrierSet::set_barrier_set(). BarrierSet* const barrier_set = BarrierSet::barrier_set(); if (barrier_set != NULL) { barrier_set->on_thread_create(this); + } else { + DEBUG_ONLY(Threads::inc_threads_before_barrier_set();) } } @@ -3397,6 +3399,7 @@ #ifdef ASSERT bool Threads::_vm_complete = false; +size_t Threads::_threads_before_barrier_set = 0; #endif static inline void *prefetch_and_load_ptr(void **addr, intx prefetch_interval) {