comparison src/share/vm/gc_implementation/g1/g1RootProcessor.cpp @ 23660:b5f3a471e646

Merge.
author Doug Simon <doug.simon@oracle.com>
date Wed, 01 Jun 2016 00:11:44 +0200
parents bd88fd590f4e c0205eddb317
children
comparison
equal deleted inserted replaced
23411:d7cf78885a3a 23660:b5f3a471e646
115 } 115 }
116 } 116 }
117 117
118 G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) : 118 G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) :
119 _g1h(g1h), 119 _g1h(g1h),
120 _process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)), 120 _process_strong_tasks(G1RP_PS_NumElements),
121 _srs(g1h), 121 _srs(g1h),
122 _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false), 122 _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false),
123 _n_workers_discovered_strong_classes(0) {} 123 _n_workers_discovered_strong_classes(0) {}
124 124
125 void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, 125 void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots,
163 } 163 }
164 164
165 process_vm_roots(strong_roots, weak_roots, phase_times, worker_i); 165 process_vm_roots(strong_roots, weak_roots, phase_times, worker_i);
166 166
167 #if INCLUDE_JVMCI 167 #if INCLUDE_JVMCI
168 if (trace_codecache && !_process_strong_tasks->is_task_claimed(G1RP_PS_CodeCache_oops_do)) { 168 if (trace_codecache && !_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) {
169 CodeCache::blobs_do(&root_code_blobs); 169 CodeCache::blobs_do(&root_code_blobs);
170 } 170 }
171 #endif 171 #endif
172 172
173 { 173 {
174 // Now the CM ref_processor roots. 174 // Now the CM ref_processor roots.
175 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i); 175 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
176 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_refProcessor_oops_do)) { 176 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_refProcessor_oops_do)) {
177 // We need to treat the discovered reference lists of the 177 // We need to treat the discovered reference lists of the
178 // concurrent mark ref processor as roots and keep entries 178 // concurrent mark ref processor as roots and keep entries
179 // (which are added by the marking threads) on them live 179 // (which are added by the marking threads) on them live
180 // until they can be processed at the end of marking. 180 // until they can be processed at the end of marking.
181 _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); 181 _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots);
214 // During conc marking we have to filter the per-thread SATB buffers 214 // During conc marking we have to filter the per-thread SATB buffers
215 // to make sure we remove any oops into the CSet (which will show up 215 // to make sure we remove any oops into the CSet (which will show up
216 // as implicitly live). 216 // as implicitly live).
217 { 217 {
218 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i); 218 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
219 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) { 219 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) {
220 JavaThread::satb_mark_queue_set().filter_thread_buffers(); 220 JavaThread::satb_mark_queue_set().filter_thread_buffers();
221 } 221 }
222 } 222 }
223 223
224 _process_strong_tasks->all_tasks_completed(); 224 _process_strong_tasks.all_tasks_completed();
225 } 225 }
226 226
227 void G1RootProcessor::process_strong_roots(OopClosure* oops, 227 void G1RootProcessor::process_strong_roots(OopClosure* oops,
228 CLDClosure* clds, 228 CLDClosure* clds,
229 CodeBlobClosure* blobs) { 229 CodeBlobClosure* blobs) {
230 230
231 process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0); 231 process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0);
232 process_vm_roots(oops, NULL, NULL, 0); 232 process_vm_roots(oops, NULL, NULL, 0);
233 233
234 _process_strong_tasks->all_tasks_completed(); 234 _process_strong_tasks.all_tasks_completed();
235 } 235 }
236 236
237 void G1RootProcessor::process_all_roots(OopClosure* oops, 237 void G1RootProcessor::process_all_roots(OopClosure* oops,
238 CLDClosure* clds, 238 CLDClosure* clds,
239 CodeBlobClosure* blobs) { 239 CodeBlobClosure* blobs) {
240 240
241 process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0); 241 process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0);
242 process_vm_roots(oops, oops, NULL, 0); 242 process_vm_roots(oops, oops, NULL, 0);
243 243
244 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_CodeCache_oops_do)) { 244 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) {
245 CodeCache::blobs_do(blobs); 245 CodeCache::blobs_do(blobs);
246 } 246 }
247 247
248 _process_strong_tasks->all_tasks_completed(); 248 _process_strong_tasks.all_tasks_completed();
249 } 249 }
250 250
251 void G1RootProcessor::process_java_roots(OopClosure* strong_roots, 251 void G1RootProcessor::process_java_roots(OopClosure* strong_roots,
252 CLDClosure* thread_stack_clds, 252 CLDClosure* thread_stack_clds,
253 CLDClosure* strong_clds, 253 CLDClosure* strong_clds,
259 // Iterating over the CLDG and the Threads are done early to allow us to 259 // Iterating over the CLDG and the Threads are done early to allow us to
260 // first process the strong CLDs and nmethods and then, after a barrier, 260 // first process the strong CLDs and nmethods and then, after a barrier,
261 // let the thread process the weak CLDs and nmethods. 261 // let the thread process the weak CLDs and nmethods.
262 { 262 {
263 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i); 263 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i);
264 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) { 264 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) {
265 ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); 265 ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds);
266 } 266 }
267 } 267 }
268 268
269 { 269 {
276 OopClosure* weak_roots, 276 OopClosure* weak_roots,
277 G1GCPhaseTimes* phase_times, 277 G1GCPhaseTimes* phase_times,
278 uint worker_i) { 278 uint worker_i) {
279 { 279 {
280 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i); 280 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i);
281 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Universe_oops_do)) { 281 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Universe_oops_do)) {
282 Universe::oops_do(strong_roots); 282 Universe::oops_do(strong_roots);
283 } 283 }
284 } 284 }
285 285
286 { 286 {
287 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i); 287 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i);
288 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_JNIHandles_oops_do)) { 288 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_JNIHandles_oops_do)) {
289 JNIHandles::oops_do(strong_roots); 289 JNIHandles::oops_do(strong_roots);
290 } 290 }
291 } 291 }
292 292
293 { 293 {
294 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i); 294 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i);
295 if (!_process_strong_tasks-> is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) { 295 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) {
296 ObjectSynchronizer::oops_do(strong_roots); 296 ObjectSynchronizer::oops_do(strong_roots);
297 } 297 }
298 } 298 }
299 299
300 { 300 {
301 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i); 301 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i);
302 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { 302 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) {
303 FlatProfiler::oops_do(strong_roots); 303 FlatProfiler::oops_do(strong_roots);
304 } 304 }
305 } 305 }
306 306
307 { 307 {
308 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i); 308 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
309 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Management_oops_do)) { 309 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Management_oops_do)) {
310 Management::oops_do(strong_roots); 310 Management::oops_do(strong_roots);
311 } 311 }
312 } 312 }
313 313
314 { 314 {
315 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i); 315 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i);
316 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_jvmti_oops_do)) { 316 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_jvmti_oops_do)) {
317 JvmtiExport::oops_do(strong_roots); 317 JvmtiExport::oops_do(strong_roots);
318 } 318 }
319 } 319 }
320 320
321 { 321 {
322 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i); 322 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
323 if (!_process_strong_tasks->is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { 323 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) {
324 SystemDictionary::roots_oops_do(strong_roots, weak_roots); 324 SystemDictionary::roots_oops_do(strong_roots, weak_roots);
325 } 325 }
326 } 326 }
327 327
328 { 328 {
346 346
347 _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i); 347 _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i);
348 } 348 }
349 349
350 void G1RootProcessor::set_num_workers(int active_workers) { 350 void G1RootProcessor::set_num_workers(int active_workers) {
351 _process_strong_tasks->set_n_threads(active_workers); 351 _process_strong_tasks.set_n_threads(active_workers);
352 } 352 }