1.1 --- a/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp Tue Jul 17 17:07:44 2018 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp Fri Jul 20 03:07:49 2018 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -156,7 +156,7 @@ 1.11 } 1.12 1.13 process_vm_roots(strong_roots, weak_roots, phase_times, worker_i); 1.14 - 1.15 + process_string_table_roots(weak_roots, phase_times, worker_i); 1.16 { 1.17 // Now the CM ref_processor roots. 1.18 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i); 1.19 @@ -223,18 +223,34 @@ 1.20 1.21 void G1RootProcessor::process_all_roots(OopClosure* oops, 1.22 CLDClosure* clds, 1.23 - CodeBlobClosure* blobs) { 1.24 + CodeBlobClosure* blobs, 1.25 + bool process_string_table) { 1.26 1.27 process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0); 1.28 process_vm_roots(oops, oops, NULL, 0); 1.29 1.30 - if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) { 1.31 - CodeCache::blobs_do(blobs); 1.32 - } 1.33 + if (process_string_table) { 1.34 + process_string_table_roots(oops, NULL, 0); 1.35 + } 1.36 + process_code_cache_roots(blobs, NULL, 0); 1.37 1.38 _process_strong_tasks.all_tasks_completed(); 1.39 } 1.40 1.41 +void G1RootProcessor::process_all_roots(OopClosure* oops, 1.42 + CLDClosure* clds, 1.43 + CodeBlobClosure* blobs) { 1.44 + process_all_roots(oops, clds, blobs, true); 1.45 +} 1.46 + 1.47 +void G1RootProcessor::process_all_roots_no_string_table(OopClosure* oops, 1.48 + CLDClosure* clds, 1.49 + CodeBlobClosure* blobs) { 1.50 + assert(!ClassUnloading, "Should only be used when class unloading is disabled"); 1.51 + process_all_roots(oops, clds, blobs, false); 1.52 +} 1.53 + 1.54 + 1.55 void G1RootProcessor::process_java_roots(OopClosure* strong_roots, 1.56 CLDClosure* thread_stack_clds, 1.57 CLDClosure* strong_clds, 1.58 @@ -311,14 +327,23 @@ 1.59 SystemDictionary::roots_oops_do(strong_roots, weak_roots); 1.60 } 1.61 } 1.62 +} 1.63 1.64 - { 1.65 - G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i); 1.66 - // All threads execute the following. A specific chunk of buckets 1.67 - // from the StringTable are the individual tasks. 1.68 - if (weak_roots != NULL) { 1.69 - StringTable::possibly_parallel_oops_do(weak_roots); 1.70 - } 1.71 +void G1RootProcessor::process_string_table_roots(OopClosure* weak_roots, G1GCPhaseTimes* phase_times, 1.72 + uint worker_i) { 1.73 + assert(weak_roots != NULL, "Should only be called when all roots are processed"); 1.74 + 1.75 + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i); 1.76 + // All threads execute the following. A specific chunk of buckets 1.77 + // from the StringTable are the individual tasks. 1.78 + StringTable::possibly_parallel_oops_do(weak_roots); 1.79 +} 1.80 + 1.81 +void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure, 1.82 + G1GCPhaseTimes* phase_times, 1.83 + uint worker_i) { 1.84 + if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) { 1.85 + CodeCache::blobs_do(code_closure); 1.86 } 1.87 } 1.88