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

changeset 9358
6a4a6c499e89
parent 8070
c0205eddb317
equal deleted inserted replaced
9357:0ef29304c2b4 9358:6a4a6c499e89
1 /* 1 /*
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
154 if (trace_metadata) { 154 if (trace_metadata) {
155 worker_has_discovered_all_strong_classes(); 155 worker_has_discovered_all_strong_classes();
156 } 156 }
157 157
158 process_vm_roots(strong_roots, weak_roots, phase_times, worker_i); 158 process_vm_roots(strong_roots, weak_roots, phase_times, worker_i);
159 159 process_string_table_roots(weak_roots, phase_times, worker_i);
160 { 160 {
161 // Now the CM ref_processor roots. 161 // Now the CM ref_processor roots.
162 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i); 162 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
163 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_refProcessor_oops_do)) { 163 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_refProcessor_oops_do)) {
164 // We need to treat the discovered reference lists of the 164 // We need to treat the discovered reference lists of the
221 _process_strong_tasks.all_tasks_completed(); 221 _process_strong_tasks.all_tasks_completed();
222 } 222 }
223 223
224 void G1RootProcessor::process_all_roots(OopClosure* oops, 224 void G1RootProcessor::process_all_roots(OopClosure* oops,
225 CLDClosure* clds, 225 CLDClosure* clds,
226 CodeBlobClosure* blobs) { 226 CodeBlobClosure* blobs,
227 bool process_string_table) {
227 228
228 process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0); 229 process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0);
229 process_vm_roots(oops, oops, NULL, 0); 230 process_vm_roots(oops, oops, NULL, 0);
230 231
231 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) { 232 if (process_string_table) {
232 CodeCache::blobs_do(blobs); 233 process_string_table_roots(oops, NULL, 0);
233 } 234 }
235 process_code_cache_roots(blobs, NULL, 0);
234 236
235 _process_strong_tasks.all_tasks_completed(); 237 _process_strong_tasks.all_tasks_completed();
236 } 238 }
239
240 void G1RootProcessor::process_all_roots(OopClosure* oops,
241 CLDClosure* clds,
242 CodeBlobClosure* blobs) {
243 process_all_roots(oops, clds, blobs, true);
244 }
245
246 void G1RootProcessor::process_all_roots_no_string_table(OopClosure* oops,
247 CLDClosure* clds,
248 CodeBlobClosure* blobs) {
249 assert(!ClassUnloading, "Should only be used when class unloading is disabled");
250 process_all_roots(oops, clds, blobs, false);
251 }
252
237 253
238 void G1RootProcessor::process_java_roots(OopClosure* strong_roots, 254 void G1RootProcessor::process_java_roots(OopClosure* strong_roots,
239 CLDClosure* thread_stack_clds, 255 CLDClosure* thread_stack_clds,
240 CLDClosure* strong_clds, 256 CLDClosure* strong_clds,
241 CLDClosure* weak_clds, 257 CLDClosure* weak_clds,
309 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i); 325 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
310 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { 326 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) {
311 SystemDictionary::roots_oops_do(strong_roots, weak_roots); 327 SystemDictionary::roots_oops_do(strong_roots, weak_roots);
312 } 328 }
313 } 329 }
314 330 }
315 { 331
316 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i); 332 void G1RootProcessor::process_string_table_roots(OopClosure* weak_roots, G1GCPhaseTimes* phase_times,
317 // All threads execute the following. A specific chunk of buckets 333 uint worker_i) {
318 // from the StringTable are the individual tasks. 334 assert(weak_roots != NULL, "Should only be called when all roots are processed");
319 if (weak_roots != NULL) { 335
320 StringTable::possibly_parallel_oops_do(weak_roots); 336 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i);
321 } 337 // All threads execute the following. A specific chunk of buckets
338 // from the StringTable are the individual tasks.
339 StringTable::possibly_parallel_oops_do(weak_roots);
340 }
341
342 void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure,
343 G1GCPhaseTimes* phase_times,
344 uint worker_i) {
345 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) {
346 CodeCache::blobs_do(code_closure);
322 } 347 }
323 } 348 }
324 349
325 void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs, 350 void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
326 OopClosure* scan_non_heap_weak_roots, 351 OopClosure* scan_non_heap_weak_roots,

mercurial