Followup to JDK-8195100 from Kim Barrett's feedback:
src/hotspot/share/utilities/globalCounter.cpp
64 // Handle bootstrap
65 if (Threads::number_of_threads() == 0) {
66 return;
67 }
What is this about? number_of_threads only refers to Java threads,
but the iteration should deal with there being none, right? Or does
this get called so early (because of SymbolTable changes) that even
that iteration setup doesn't work?
If not that, then maybe we're calling before the VMThread exists, and
that's the real problem? In which case a different test, differently
located, seems necessary.
We needed it when I was bringing up the code and I tried removing it to see whether we still need it and it seems that we do (details on the crash in the bug itself). Maybe Robbin can shed more light here?
The problem here is that we're using the StringTable (and therefore
GlobalCounter) before the main thread has been registered. That
registration happens in create_vm() (Threads::add(main_thread), line
3729), which follows the call to init_globals() (where the symbol
table usage is occurring) in create_vm().
Maybe moving the Threads::add earlier would fix the problem? But this
initialization code is very ordering sensitive, so I don't know if
that would work.