59 void G1RootProcessor::wait_until_all_strong_classes_discovered() {
60 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
61
62 if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
63 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
64 while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
65 _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);
66 }
67 }
68 }
69
70 G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h, uint n_workers) :
71 _g1h(g1h),
72 _process_strong_tasks(G1RP_PS_NumElements),
73 _srs(n_workers),
74 _par_state_string(StringTable::weak_storage()),
75 _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never),
76 _n_workers_discovered_strong_classes(0) {}
77
78 void G1RootProcessor::evacuate_roots(G1ParScanThreadState* pss, uint worker_i) {
79 G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times();
80
81 G1EvacPhaseTimesTracker timer(phase_times, pss, G1GCPhaseTimes::ExtRootScan, worker_i);
82
83 G1EvacuationRootClosures* closures = pss->closures();
84 process_java_roots(closures, phase_times, worker_i);
85
86 // This is the point where this worker thread will not find more strong CLDs/nmethods.
87 // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
88 if (closures->trace_metadata()) {
89 worker_has_discovered_all_strong_classes();
90 }
91
92 process_vm_roots(closures, phase_times, worker_i);
93
94 {
95 // Now the CM ref_processor roots.
96 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
97 if (_process_strong_tasks.try_claim_task(G1RP_PS_refProcessor_oops_do)) {
98 // We need to treat the discovered reference lists of the
99 // concurrent mark ref processor as roots and keep entries
|
59 void G1RootProcessor::wait_until_all_strong_classes_discovered() {
60 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
61
62 if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
63 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
64 while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
65 _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);
66 }
67 }
68 }
69
70 G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h, uint n_workers) :
71 _g1h(g1h),
72 _process_strong_tasks(G1RP_PS_NumElements),
73 _srs(n_workers),
74 _par_state_string(StringTable::weak_storage()),
75 _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never),
76 _n_workers_discovered_strong_classes(0) {}
77
78 void G1RootProcessor::evacuate_roots(G1ParScanThreadState* pss, uint worker_i) {
79 G1GCPhaseTimes* phase_times = _g1h->policy()->phase_times();
80
81 G1EvacPhaseTimesTracker timer(phase_times, pss, G1GCPhaseTimes::ExtRootScan, worker_i);
82
83 G1EvacuationRootClosures* closures = pss->closures();
84 process_java_roots(closures, phase_times, worker_i);
85
86 // This is the point where this worker thread will not find more strong CLDs/nmethods.
87 // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
88 if (closures->trace_metadata()) {
89 worker_has_discovered_all_strong_classes();
90 }
91
92 process_vm_roots(closures, phase_times, worker_i);
93
94 {
95 // Now the CM ref_processor roots.
96 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
97 if (_process_strong_tasks.try_claim_task(G1RP_PS_refProcessor_oops_do)) {
98 // We need to treat the discovered reference lists of the
99 // concurrent mark ref processor as roots and keep entries
|