< prev index next >
src/share/vm/runtime/thread.cpp
Print this page
*** 752,768 ****
jint res = Atomic::cmpxchg(strong_roots_parity, &_oops_do_parity, thread_parity);
if (res == thread_parity) {
return true;
} else {
guarantee(res == strong_roots_parity, "Or else what?");
- assert(SharedHeap::heap()->workers()->active_workers() > 0,
- "Should only fail when parallel.");
return false;
}
}
- assert(SharedHeap::heap()->workers()->active_workers() > 0,
- "Should only fail when parallel.");
return false;
}
void Thread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
active_handles()->oops_do(f);
--- 752,764 ----
*** 4064,4087 ****
err_msg("Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity));
}
}
#endif // PRODUCT
! void Threads::possibly_parallel_oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
! // Introduce a mechanism allowing parallel threads to claim threads as
! // root groups. Overhead should be small enough to use all the time,
! // even in sequential code.
! SharedHeap* sh = SharedHeap::heap();
! // Cannot yet substitute active_workers for n_par_threads
! // because of G1CollectedHeap::verify() use of
! // SharedHeap::process_roots(). n_par_threads == 0 will
! // turn off parallelism in process_roots while active_workers
! // is being used for parallelism elsewhere.
! bool is_par = sh->n_par_threads() > 0;
! assert(!is_par ||
! (SharedHeap::heap()->n_par_threads() ==
! SharedHeap::heap()->workers()->active_workers()), "Mismatch");
int cp = Threads::thread_claim_parity();
ALL_JAVA_THREADS(p) {
if (p->claim_oops_do(is_par, cp)) {
p->oops_do(f, cld_f, cf);
}
--- 4060,4070 ----
err_msg("Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity));
}
}
#endif // PRODUCT
! void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) {
int cp = Threads::thread_claim_parity();
ALL_JAVA_THREADS(p) {
if (p->claim_oops_do(is_par, cp)) {
p->oops_do(f, cld_f, cf);
}
< prev index next >