The creation functions of RuntimeStub, DeoptimizationBlob, UncommonTrapBlob, ExceptionBlob, SafepointBlob, and nmethod, compute allocation size under lock protection, but there is no risk of data race for this kind of calculation. They can be moved outside of the critical section in the same way it is done in 'BufferBlob::create', 'AdapterBlob::create' and
'UpcallStub::create'.
Change from:
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
... CodeBlob::allocation_size(cb, sizeof(...));
...
}
to
... CodeBlob::allocation_size(cb, sizeof(...));
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
...
}
'UpcallStub::create'.
Change from:
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
... CodeBlob::allocation_size(cb, sizeof(...));
...
}
to
... CodeBlob::allocation_size(cb, sizeof(...));
{
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
...
}