8185273: Test8004741.java crashes with SIGSEGV in JDK10-hs nightly

Threads::parallel_java_threads_do() needs to call VMThread::claim_oops_do() to avoid causing a parallel GC to miss the VMThread.

Reviewed-by: shade, rkennke, kvn, gthornbr
This commit is contained in:
Daniel D. Daugherty 2017-07-31 12:37:34 -07:00
parent 149e9c6e54
commit 7a713e117a
4 changed files with 20 additions and 2 deletions

View file

@ -3392,6 +3392,13 @@ void Threads::parallel_java_threads_do(ThreadClosure* tc) {
tc->do_thread(p);
}
}
// Thread claiming protocol requires us to claim the same interesting
// threads on all paths. Notably, Threads::possibly_parallel_threads_do
// claims all Java threads *and* the VMThread. To avoid breaking the
// claiming protocol, we have to claim VMThread on this path too, even
// if we do not apply the closure to the VMThread.
VMThread* vmt = VMThread::vm_thread();
(void)vmt->claim_oops_do(true, cp);
}
// The system initialization in the library has three phases.
@ -4357,6 +4364,10 @@ void Threads::assert_all_threads_claimed() {
assert((thread_parity == _thread_claim_parity),
"Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity);
}
VMThread* vmt = VMThread::vm_thread();
const int thread_parity = vmt->oops_do_parity();
assert((thread_parity == _thread_claim_parity),
"VMThread " PTR_FORMAT " has incorrect parity %d != %d", p2i(vmt), thread_parity, _thread_claim_parity);
}
#endif // ASSERT