1.1 --- a/src/share/vm/memory/sharedHeap.cpp Thu Aug 07 15:02:18 2014 -0700 1.2 +++ b/src/share/vm/memory/sharedHeap.cpp Tue Jan 14 16:40:33 2014 +0100 1.3 @@ -139,7 +139,6 @@ 1.4 } 1.5 1.6 void SharedHeap::process_strong_roots(bool activate_scope, 1.7 - bool is_scavenging, 1.8 ScanningOption so, 1.9 OopClosure* roots, 1.10 CodeBlobClosure* code_roots, 1.11 @@ -159,9 +158,11 @@ 1.12 if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) 1.13 JNIHandles::oops_do(roots); 1.14 1.15 + CLDToOopClosure roots_from_clds(roots); 1.16 + // If we limit class scanning to SO_SystemClasses we need to apply a CLD closure to 1.17 + // CLDs which are strongly reachable from the thread stacks. 1.18 + CLDToOopClosure* roots_from_clds_p = ((so & SO_SystemClasses) ? &roots_from_clds : NULL); 1.19 // All threads execute this; the individual threads are task groups. 1.20 - CLDToOopClosure roots_from_clds(roots); 1.21 - CLDToOopClosure* roots_from_clds_p = (is_scavenging ? NULL : &roots_from_clds); 1.22 if (CollectedHeap::use_parallel_gc_threads()) { 1.23 Threads::possibly_parallel_oops_do(roots, roots_from_clds_p, code_roots); 1.24 } else { 1.25 @@ -189,9 +190,9 @@ 1.26 1.27 if (!_process_strong_tasks->is_task_claimed(SH_PS_ClassLoaderDataGraph_oops_do)) { 1.28 if (so & SO_AllClasses) { 1.29 - ClassLoaderDataGraph::oops_do(roots, klass_closure, !is_scavenging); 1.30 + ClassLoaderDataGraph::oops_do(roots, klass_closure, /* must_claim */ false); 1.31 } else if (so & SO_SystemClasses) { 1.32 - ClassLoaderDataGraph::always_strong_oops_do(roots, klass_closure, !is_scavenging); 1.33 + ClassLoaderDataGraph::always_strong_oops_do(roots, klass_closure, /* must_claim */ true); 1.34 } 1.35 } 1.36 1.37 @@ -206,17 +207,18 @@ 1.38 } 1.39 1.40 if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) { 1.41 - if (so & SO_CodeCache) { 1.42 + if (so & SO_ScavengeCodeCache) { 1.43 assert(code_roots != NULL, "must supply closure for code cache"); 1.44 1.45 - if (is_scavenging) { 1.46 - // We only visit parts of the CodeCache when scavenging. 1.47 - CodeCache::scavenge_root_nmethods_do(code_roots); 1.48 - } else { 1.49 - // CMSCollector uses this to do intermediate-strength collections. 1.50 - // We scan the entire code cache, since CodeCache::do_unloading is not called. 1.51 - CodeCache::blobs_do(code_roots); 1.52 - } 1.53 + // We only visit parts of the CodeCache when scavenging. 1.54 + CodeCache::scavenge_root_nmethods_do(code_roots); 1.55 + } 1.56 + if (so & SO_AllCodeCache) { 1.57 + assert(code_roots != NULL, "must supply closure for code cache"); 1.58 + 1.59 + // CMSCollector uses this to do intermediate-strength collections. 1.60 + // We scan the entire code cache, since CodeCache::do_unloading is not called. 1.61 + CodeCache::blobs_do(code_roots); 1.62 } 1.63 // Verify that the code cache contents are not subject to 1.64 // movement by a scavenging collection.