< prev index next >
src/share/vm/gc/shared/genCollectedHeap.cpp
Print this page
rev 11983 : 8166276: Refactor gen_process_roots to allow simpler fix for 8165949
Reviewed-by:
Contributed-by: jesper.wilhelmsson@oracle.com
rev 11985 : 8165949: Serial and ConcMarkSweep do not unload strings when class unloading is disabled
Reviewed-by:
rev 11986 : imported patch 8165949-on-jesper-mik-rev
rev 11987 : [mq]: 8165949-on-jesper-stefank-rev
@@ -611,20 +611,10 @@
if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) {
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");
// We only visit parts of the CodeCache when scavenging.
@@ -642,18 +632,31 @@
DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
}
}
+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,
CLDClosure* cld_closure) {
MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
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();
}
@@ -675,10 +678,13 @@
MarkingCodeBlobClosure mark_code_closure(root_closure, !CodeBlobToOopClosure::FixRelocations);
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 (!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)) {
root_closure->set_generation(_young_gen);
_young_gen->oop_iterate(root_closure);
@@ -687,20 +693,26 @@
_process_strong_tasks->all_tasks_completed(scope->n_threads());
}
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());
}
void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
< prev index next >