< prev index next >
src/hotspot/share/runtime/sweeper.cpp
Print this page
rev 51807 : imported patch nmethod-marking.patch
rev 51808 : 8132849: Increased stop time in cleanup phase because of single-threaded walk of thread stacks in NMethodSweeper::mark_active_nmethods()
rev 51809 : [mq]: JDK-8132849-01.patch
@@ -245,10 +245,19 @@
}
}
}
CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
+#ifdef ASSERT
+ if (ThreadLocalHandshakes) {
+ assert(Thread::current()->is_Code_cache_sweeper_thread(), "must be executed under CodeCache_lock and in sweeper thread");
+ assert_lock_strong(CodeCache_lock);
+ } else {
+ assert(SafepointSynchronize::is_at_safepoint(), "must be executed at a safepoint");
+ }
+#endif
+
// If we do not want to reclaim not-entrant or zombie methods there is no need
// to scan stacks
if (!MethodFlushing) {
return NULL;
}
@@ -293,11 +302,15 @@
*/
void NMethodSweeper::do_stack_scanning() {
assert(!CodeCache_lock->owned_by_self(), "just checking");
if (wait_for_stack_scanning()) {
if (ThreadLocalHandshakes) {
- CodeBlobClosure* code_cl = prepare_mark_active_nmethods();
+ CodeBlobClosure* code_cl;
+ {
+ MutexLockerEx ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ code_cl = prepare_mark_active_nmethods();
+ }
if (code_cl != NULL) {
ThreadToCodeBlobClosure tcl(code_cl);
Handshake::execute(&tcl);
}
} else {
< prev index next >