With the SR_lock removal, the only lock that is taken with safepoint checking but sometimes with Mutex::_no_safepoint_check is the Heap_lock. That lock acquisition is during thread exit, and there's already code that doesn't do safepoint checking for that condition:
bool is_active_Java_thread = self->is_active_Java_thread();
...
if (is_active_Java_thread) {
assert(rank() > Mutex::special, "Potential deadlock with special or lesser rank mutex");
{ ThreadBlockInVM tbivmdc(self->as_Java_thread(), &in_flight_mutex);
in_flight_mutex = this; // save for ~ThreadBlockInVM
_lock.lock();
}
So there's no need for safepoint_check_sometimes anymore.
bool is_active_Java_thread = self->is_active_Java_thread();
...
if (is_active_Java_thread) {
assert(rank() > Mutex::special, "Potential deadlock with special or lesser rank mutex");
{ ThreadBlockInVM tbivmdc(self->as_Java_thread(), &in_flight_mutex);
in_flight_mutex = this; // save for ~ThreadBlockInVM
_lock.lock();
}
So there's no need for safepoint_check_sometimes anymore.