RFR(S) 8187040: ThreadCritical crashes on Solaris if used between os::init and os::init_2
mikael.gerdin at oracle.com
Fri Sep 1 15:23:54 UTC 2017
Please review this small fix to ThreadCritical.
When working on a piece of code which allocates memory early on I
noticed that it crashed if I enabled NMT.
The reason is that NMT uses ThreadCritical and os::Solaris sets the
ThreadCritical::_initialized flag before it actually sets up the
function pointers the flag is supposed to guard.
os::Solaris::_mutex_lock is not initialized until the init_2 phase
(after command line flag parsing).
My suggested fix is to replace the current short-circuit of
ThreadCritical with a flag set when the Solaris mutex code is
initialized and thereby getting rid of the initialize function on all
Additionally, ThreadCritical::release is unreachable code and from my
research has never actually been called, we might as well get rid of it.
More information about the hotspot-runtime-dev