comparison src/share/vm/memory/sharedHeap.cpp @ 20257:7426d8d76305

8034761: Remove the do_code_roots parameter from process_strong_roots Reviewed-by: tschatzl, mgerdin, jmasa
author stefank
date Thu, 13 Feb 2014 17:44:39 +0100
parents 9fec19bb0659
children 64ac9c55d666
comparison
equal deleted inserted replaced
20256:b0b97602393a 20257:7426d8d76305
139 } 139 }
140 140
141 void SharedHeap::process_strong_roots(bool activate_scope, 141 void SharedHeap::process_strong_roots(bool activate_scope,
142 ScanningOption so, 142 ScanningOption so,
143 OopClosure* roots, 143 OopClosure* roots,
144 CodeBlobClosure* code_roots,
145 KlassClosure* klass_closure) { 144 KlassClosure* klass_closure) {
146 StrongRootsScope srs(this, activate_scope); 145 StrongRootsScope srs(this, activate_scope);
147 146
148 // General strong roots. 147 // General strong roots.
149 assert(_strong_roots_parity != 0, "must have called prologue code"); 148 assert(_strong_roots_parity != 0, "must have called prologue code");
156 } 155 }
157 // Global (strong) JNI handles 156 // Global (strong) JNI handles
158 if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) 157 if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do))
159 JNIHandles::oops_do(roots); 158 JNIHandles::oops_do(roots);
160 159
160 CodeBlobToOopClosure code_roots(roots, true);
161
161 CLDToOopClosure roots_from_clds(roots); 162 CLDToOopClosure roots_from_clds(roots);
162 // If we limit class scanning to SO_SystemClasses we need to apply a CLD closure to 163 // If we limit class scanning to SO_SystemClasses we need to apply a CLD closure to
163 // CLDs which are strongly reachable from the thread stacks. 164 // CLDs which are strongly reachable from the thread stacks.
164 CLDToOopClosure* roots_from_clds_p = ((so & SO_SystemClasses) ? &roots_from_clds : NULL); 165 CLDToOopClosure* roots_from_clds_p = ((so & SO_SystemClasses) ? &roots_from_clds : NULL);
165 // All threads execute this; the individual threads are task groups. 166 // All threads execute this; the individual threads are task groups.
166 if (CollectedHeap::use_parallel_gc_threads()) { 167 if (CollectedHeap::use_parallel_gc_threads()) {
167 Threads::possibly_parallel_oops_do(roots, roots_from_clds_p, code_roots); 168 Threads::possibly_parallel_oops_do(roots, roots_from_clds_p, &code_roots);
168 } else { 169 } else {
169 Threads::oops_do(roots, roots_from_clds_p, code_roots); 170 Threads::oops_do(roots, roots_from_clds_p, &code_roots);
170 } 171 }
171 172
172 if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do)) 173 if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do))
173 ObjectSynchronizer::oops_do(roots); 174 ObjectSynchronizer::oops_do(roots);
174 if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do)) 175 if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do))
206 } 207 }
207 } 208 }
208 209
209 if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) { 210 if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) {
210 if (so & SO_ScavengeCodeCache) { 211 if (so & SO_ScavengeCodeCache) {
211 assert(code_roots != NULL, "must supply closure for code cache"); 212 assert(&code_roots != NULL, "must supply closure for code cache");
212 213
213 // We only visit parts of the CodeCache when scavenging. 214 // We only visit parts of the CodeCache when scavenging.
214 CodeCache::scavenge_root_nmethods_do(code_roots); 215 CodeCache::scavenge_root_nmethods_do(&code_roots);
215 } 216 }
216 if (so & SO_AllCodeCache) { 217 if (so & SO_AllCodeCache) {
217 assert(code_roots != NULL, "must supply closure for code cache"); 218 assert(&code_roots != NULL, "must supply closure for code cache");
218 219
219 // CMSCollector uses this to do intermediate-strength collections. 220 // CMSCollector uses this to do intermediate-strength collections.
220 // We scan the entire code cache, since CodeCache::do_unloading is not called. 221 // We scan the entire code cache, since CodeCache::do_unloading is not called.
221 CodeCache::blobs_do(code_roots); 222 CodeCache::blobs_do(&code_roots);
222 } 223 }
223 // Verify that the code cache contents are not subject to 224 // Verify that the code cache contents are not subject to
224 // movement by a scavenging collection. 225 // movement by a scavenging collection.
225 DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, /*do_marking=*/ false)); 226 DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, /*do_marking=*/ false));
226 DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable)); 227 DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
233 public: 234 public:
234 bool do_object_b(oop p) { return true; } 235 bool do_object_b(oop p) { return true; }
235 }; 236 };
236 static AlwaysTrueClosure always_true; 237 static AlwaysTrueClosure always_true;
237 238
238 void SharedHeap::process_weak_roots(OopClosure* root_closure, 239 void SharedHeap::process_weak_roots(OopClosure* root_closure) {
239 CodeBlobClosure* code_roots) {
240 // Global (weak) JNI handles 240 // Global (weak) JNI handles
241 JNIHandles::weak_oops_do(&always_true, root_closure); 241 JNIHandles::weak_oops_do(&always_true, root_closure);
242 242
243 CodeCache::blobs_do(code_roots);
244 StringTable::oops_do(root_closure); 243 StringTable::oops_do(root_closure);
245 } 244 }
246 245
247 void SharedHeap::set_barrier_set(BarrierSet* bs) { 246 void SharedHeap::set_barrier_set(BarrierSet* bs) {
248 _barrier_set = bs; 247 _barrier_set = bs;