186 bool clear_all_softrefs) {
187 // Recursively traverse all live objects and mark them
188 GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
189 trace(" 1");
190
191 GenCollectedHeap* gch = GenCollectedHeap::heap();
192
193 // Because follow_root_closure is created statically, cannot
194 // use OopsInGenClosure constructor which takes a generation,
195 // as the Universe has not been created when the static constructors
196 // are run.
197 assert(level == 1, "We don't use mark-sweep on young generations");
198 follow_root_closure.set_orig_generation(gch->old_gen());
199
200 // Need new claim bits before marking starts.
201 ClassLoaderDataGraph::clear_claimed_marks();
202
203 gch->gen_process_roots(level,
204 false, // Younger gens are not roots.
205 true, // activate StrongRootsScope
206 SharedHeap::SO_None,
207 GenCollectedHeap::StrongRootsOnly,
208 &follow_root_closure,
209 &follow_root_closure,
210 &follow_cld_closure);
211
212 // Process reference objects found during marking
213 {
214 ref_processor()->setup_policy(clear_all_softrefs);
215 const ReferenceProcessorStats& stats =
216 ref_processor()->process_discovered_references(
217 &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer, _gc_tracer->gc_id());
218 gc_tracer()->report_gc_reference_stats(stats);
219 }
220
221 // This is the point where the entire marking should have completed.
222 assert(_marking_stack.is_empty(), "Marking should have completed");
223
224 // Unload classes and purge the SystemDictionary.
225 bool purged_class = SystemDictionary::do_unloading(&is_alive);
226
272 void GenMarkSweep::mark_sweep_phase3(int level) {
273 GenCollectedHeap* gch = GenCollectedHeap::heap();
274
275 // Adjust the pointers to reflect the new locations
276 GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
277 trace("3");
278
279 // Need new claim bits for the pointer adjustment tracing.
280 ClassLoaderDataGraph::clear_claimed_marks();
281
282 // Because the closure below is created statically, we cannot
283 // use OopsInGenClosure constructor which takes a generation,
284 // as the Universe has not been created when the static constructors
285 // are run.
286 assert(level == 1, "We don't use mark-sweep on young generations.");
287 adjust_pointer_closure.set_orig_generation(gch->old_gen());
288
289 gch->gen_process_roots(level,
290 false, // Younger gens are not roots.
291 true, // activate StrongRootsScope
292 SharedHeap::SO_AllCodeCache,
293 GenCollectedHeap::StrongAndWeakRoots,
294 &adjust_pointer_closure,
295 &adjust_pointer_closure,
296 &adjust_cld_closure);
297
298 gch->gen_process_weak_roots(&adjust_pointer_closure);
299
300 adjust_marks();
301 GenAdjustPointersClosure blk;
302 gch->generation_iterate(&blk, true);
303 }
304
305 class GenCompactClosure: public GenCollectedHeap::GenClosure {
306 public:
307 void do_generation(Generation* gen) {
308 gen->compact();
309 }
310 };
311
312 void GenMarkSweep::mark_sweep_phase4() {
|
186 bool clear_all_softrefs) {
187 // Recursively traverse all live objects and mark them
188 GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
189 trace(" 1");
190
191 GenCollectedHeap* gch = GenCollectedHeap::heap();
192
193 // Because follow_root_closure is created statically, cannot
194 // use OopsInGenClosure constructor which takes a generation,
195 // as the Universe has not been created when the static constructors
196 // are run.
197 assert(level == 1, "We don't use mark-sweep on young generations");
198 follow_root_closure.set_orig_generation(gch->old_gen());
199
200 // Need new claim bits before marking starts.
201 ClassLoaderDataGraph::clear_claimed_marks();
202
203 gch->gen_process_roots(level,
204 false, // Younger gens are not roots.
205 true, // activate StrongRootsScope
206 GenCollectedHeap::SO_None,
207 GenCollectedHeap::StrongRootsOnly,
208 &follow_root_closure,
209 &follow_root_closure,
210 &follow_cld_closure);
211
212 // Process reference objects found during marking
213 {
214 ref_processor()->setup_policy(clear_all_softrefs);
215 const ReferenceProcessorStats& stats =
216 ref_processor()->process_discovered_references(
217 &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer, _gc_tracer->gc_id());
218 gc_tracer()->report_gc_reference_stats(stats);
219 }
220
221 // This is the point where the entire marking should have completed.
222 assert(_marking_stack.is_empty(), "Marking should have completed");
223
224 // Unload classes and purge the SystemDictionary.
225 bool purged_class = SystemDictionary::do_unloading(&is_alive);
226
272 void GenMarkSweep::mark_sweep_phase3(int level) {
273 GenCollectedHeap* gch = GenCollectedHeap::heap();
274
275 // Adjust the pointers to reflect the new locations
276 GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
277 trace("3");
278
279 // Need new claim bits for the pointer adjustment tracing.
280 ClassLoaderDataGraph::clear_claimed_marks();
281
282 // Because the closure below is created statically, we cannot
283 // use OopsInGenClosure constructor which takes a generation,
284 // as the Universe has not been created when the static constructors
285 // are run.
286 assert(level == 1, "We don't use mark-sweep on young generations.");
287 adjust_pointer_closure.set_orig_generation(gch->old_gen());
288
289 gch->gen_process_roots(level,
290 false, // Younger gens are not roots.
291 true, // activate StrongRootsScope
292 GenCollectedHeap::SO_AllCodeCache,
293 GenCollectedHeap::StrongAndWeakRoots,
294 &adjust_pointer_closure,
295 &adjust_pointer_closure,
296 &adjust_cld_closure);
297
298 gch->gen_process_weak_roots(&adjust_pointer_closure);
299
300 adjust_marks();
301 GenAdjustPointersClosure blk;
302 gch->generation_iterate(&blk, true);
303 }
304
305 class GenCompactClosure: public GenCollectedHeap::GenClosure {
306 public:
307 void do_generation(Generation* gen) {
308 gen->compact();
309 }
310 };
311
312 void GenMarkSweep::mark_sweep_phase4() {
|