--- a/src/hotspot/share/utilities/globalCounter.cpp Tue Aug 14 14:08:04 2018 -0700
+++ b/src/hotspot/share/utilities/globalCounter.cpp Tue Aug 14 18:42:14 2018 -0500
@@ -61,6 +61,11 @@
// Atomic::add must provide fence since we have storeload dependency.
volatile uintx gbl_cnt = Atomic::add((uintx)COUNTER_INCREMENT, &_global_counter._counter,
memory_order_conservative);
+ // Handle bootstrap
+ if (Threads::number_of_threads() == 0) {
+ return;
+ }
+
// Do all RCU threads.
CounterThreadCheck ctc(gbl_cnt);
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {