src/share/vm/runtime/sweeper.cpp

changeset 3572
cfdfbeac0a5b
parent 2916
f52ed367b66d
child 3900
d2a62e0f25eb
     1.1 --- a/src/share/vm/runtime/sweeper.cpp	Wed Feb 15 10:12:55 2012 -0800
     1.2 +++ b/src/share/vm/runtime/sweeper.cpp	Wed Feb 15 12:32:03 2012 -0800
     1.3 @@ -266,7 +266,17 @@
     1.4  
     1.5      // The last invocation iterates until there are no more nmethods
     1.6      for (int i = 0; (i < todo || _invocations == 1) && _current != NULL; i++) {
     1.7 +      if (SafepointSynchronize::is_synchronizing()) { // Safepoint request
     1.8 +        if (PrintMethodFlushing && Verbose) {
     1.9 +          tty->print_cr("### Sweep at %d out of %d, invocation: %d, yielding to safepoint", _seen, CodeCache::nof_nmethods(), _invocations);
    1.10 +        }
    1.11 +        MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
    1.12  
    1.13 +        assert(Thread::current()->is_Java_thread(), "should be java thread");
    1.14 +        JavaThread* thread = (JavaThread*)Thread::current();
    1.15 +        ThreadBlockInVM tbivm(thread);
    1.16 +        thread->java_suspend_self();
    1.17 +      }
    1.18        // Since we will give up the CodeCache_lock, always skip ahead
    1.19        // to the next nmethod.  Other blobs can be deleted by other
    1.20        // threads but nmethods are only reclaimed by the sweeper.

mercurial