8209495: NMethodSweeper::sweep_code_cache cause severe delays

Reviewed-by: thartmann, eosterlund
This commit is contained in:
Robbin Ehn 2018-11-01 17:56:01 +01:00
parent 3eef9c7997
commit 9a043c50f9

View File

@ -387,13 +387,13 @@ void NMethodSweeper::force_sweep() {
* Handle a safepoint request
*/
void NMethodSweeper::handle_safepoint_request() {
if (SafepointSynchronize::is_synchronizing()) {
JavaThread* thread = JavaThread::current();
if (SafepointMechanism::poll(thread)) {
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Sweep at %d out of %d, yielding to safepoint", _seen, CodeCache::nmethod_count());
}
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
JavaThread* thread = JavaThread::current();
ThreadBlockInVM tbivm(thread);
thread->java_suspend_self();
}