--- old/src/share/vm/gc/shared/genCollectedHeap.cpp 2016-09-21 14:34:29.868876004 +0200 +++ new/src/share/vm/gc/shared/genCollectedHeap.cpp 2016-09-21 14:34:29.732870694 +0200 @@ -613,16 +613,6 @@ SystemDictionary::roots_oops_do(strong_roots, weak_roots); } - // All threads execute the following. A specific chunk of buckets - // from the StringTable are the individual tasks. - if (weak_roots != NULL) { - if (is_par) { - StringTable::possibly_parallel_oops_do(weak_roots); - } else { - StringTable::oops_do(weak_roots); - } - } - if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) { if (so & SO_ScavengeCodeCache) { assert(code_roots != NULL, "must supply closure for code cache"); @@ -644,6 +634,18 @@ } } +void GenCollectedHeap::process_string_table_roots(StrongRootsScope* scope, + OopClosure* root_closure) { + assert(root_closure != NULL, "Must be set"); + // All threads execute the following. A specific chunk of buckets + // from the StringTable are the individual tasks. + if (scope->n_threads() > 1) { + StringTable::possibly_parallel_oops_do(root_closure); + } else { + StringTable::oops_do(root_closure); + } +} + void GenCollectedHeap::young_process_roots(StrongRootsScope* scope, OopsInGenClosure* root_closure, OopsInGenClosure* old_gen_closure, @@ -652,6 +654,7 @@ process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure, cld_closure, cld_closure, &mark_code_closure); + process_string_table_roots(scope, root_closure); if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) { root_closure->reset_generation(); @@ -677,6 +680,9 @@ CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure; process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure); + if (!only_strong_roots) { + process_string_table_roots(scope, root_closure); + } if (young_gen_as_roots && !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) { @@ -689,16 +695,22 @@ } void GenCollectedHeap::full_process_roots(StrongRootsScope* scope, - bool only_strong_roots, - ScanningOption so, bool is_adjust_phase, + ScanningOption so, + bool only_strong_roots, OopsInGenClosure* root_closure, CLDClosure* cld_closure) { MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase); - OopsInGenClosure* weak_roots = is_adjust_phase ? root_closure : NULL; + OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure; CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure; process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure); + if (is_adjust_phase) { + // We never treat the string table as roots during marking + // for the full gc, so we only need to process it during + // the adjust phase. + process_string_table_roots(scope, root_closure); + } _process_strong_tasks->all_tasks_completed(scope->n_threads()); }