8209495: NMethodSweeper::sweep_code_cache cause severe delays
authorrehn
Thu, 01 Nov 2018 17:56:01 +0100
changeset 52374 5ea020bcaa0d
parent 52373 c9bbf33fd1ae
child 52375 7b20c27b2ccb
8209495: NMethodSweeper::sweep_code_cache cause severe delays Reviewed-by: thartmann, eosterlund
src/hotspot/share/runtime/sweeper.cpp
--- 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();
   }