8209495: NMethodSweeper::sweep_code_cache cause severe delays
Reviewed-by: thartmann, eosterlund
--- a/src/hotspot/share/runtime/sweeper.cpp Thu Nov 01 12:43:21 2018 -0400
+++ b/src/hotspot/share/runtime/sweeper.cpp Thu Nov 01 17:56:01 2018 +0100
@@ -387,13 +387,13 @@
* 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();
}