< prev index next >

src/share/vm/gc_implementation/g1/g1RootProcessor.cpp

Print this page

        

*** 88,124 **** } }; void G1RootProcessor::worker_has_discovered_all_strong_classes() { - uint n_workers = _g1h->n_par_threads(); assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); ! if (new_value == n_workers) { // This thread is last. Notify the others. MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); _lock.notify_all(); } } void G1RootProcessor::wait_until_all_strong_classes_discovered() { - uint n_workers = _g1h->n_par_threads(); assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); ! if ((uint)_n_workers_discovered_strong_classes != n_workers) { MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); ! while ((uint)_n_workers_discovered_strong_classes != n_workers) { _lock.wait(Mutex::_no_safepoint_check_flag, 0, false); } } } ! G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) : _g1h(g1h), _process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)), ! _srs(), _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never), _n_workers_discovered_strong_classes(0) {} void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, OopClosure* scan_non_heap_weak_roots, --- 88,122 ---- } }; void G1RootProcessor::worker_has_discovered_all_strong_classes() { assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); ! if (new_value == n_workers()) { // This thread is last. Notify the others. MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); _lock.notify_all(); } } void G1RootProcessor::wait_until_all_strong_classes_discovered() { assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); ! if ((uint)_n_workers_discovered_strong_classes != n_workers()) { MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); ! while ((uint)_n_workers_discovered_strong_classes != n_workers()) { _lock.wait(Mutex::_no_safepoint_check_flag, 0, false); } } } ! G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h, uint n_workers) : _g1h(g1h), _process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)), ! _srs(n_workers), _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never), _n_workers_discovered_strong_classes(0) {} void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, OopClosure* scan_non_heap_weak_roots,
*** 251,261 **** } } { G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i); ! bool is_par = _g1h->n_par_threads() > 1; Threads::possibly_parallel_oops_do(is_par, strong_roots, thread_stack_clds, strong_code); } } void G1RootProcessor::process_vm_roots(OopClosure* strong_roots, --- 249,259 ---- } } { G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i); ! bool is_par = n_workers() > 1; Threads::possibly_parallel_oops_do(is_par, strong_roots, thread_stack_clds, strong_code); } } void G1RootProcessor::process_vm_roots(OopClosure* strong_roots,
*** 328,334 **** --- 326,340 ---- _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i); } void G1RootProcessor::set_num_workers(uint active_workers) { + assert(active_workers == _srs.n_threads(), + err_msg("Mismatch between number of worker threads. active_workers: %u and n_workers(): %u", + active_workers, + _srs.n_threads())); _process_strong_tasks->set_n_threads(active_workers); } + + uint G1RootProcessor::n_workers() const { + return _srs.n_threads(); + }
< prev index next >