< prev index next >
src/share/vm/runtime/thread.cpp
Print this page
*** 3390,3399 ****
--- 3390,3406 ----
ALL_JAVA_THREADS(p) {
if (p->claim_oops_do(true, cp)) {
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.
//
// Phase 1: java.lang.System class initialization
*** 4355,4364 ****
--- 4362,4375 ----
ALL_JAVA_THREADS(p) {
const int thread_parity = p->oops_do_parity();
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
void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf) {
int cp = Threads::thread_claim_parity();
< prev index next >