--- old/src/hotspot/share/gc/shared/barrierSet.cpp 2018-04-11 11:33:01.321215884 +0200 +++ new/src/hotspot/share/gc/shared/barrierSet.cpp 2018-04-11 11:33:01.116207027 +0200 @@ -24,5 +24,16 @@ #include "precompiled.hpp" #include "gc/shared/barrierSet.hpp" +#include "runtime/thread.hpp" -BarrierSet* BarrierSet::_bs = NULL; +BarrierSet* BarrierSet::_barrier_set = NULL; + +void BarrierSet::set_barrier_set(BarrierSet* barrier_set) { + assert(_barrier_set == NULL, "Already initialized"); + _barrier_set = barrier_set; + + // The barrier set was not initialized when the this thread (the main thread) + // was created, so the call to BarrierSet::on_thread_create() had to be deferred + // until we have a barrier set. Now we have a barrier set, so we make the call. + _barrier_set->on_thread_create(Thread::current()); +}