300
301 void G1MarkSweep::mark_sweep_phase4() {
302 // All pointers are now adjusted, move objects accordingly
303
304 // The ValidateMarkSweep live oops tracking expects us to traverse spaces
305 // in the same order in phase2, phase3 and phase4. We don't quite do that
306 // here (code and comment not fixed for perm removal), so we tell the validate code
307 // to use a higher index (saved from phase2) when verifying perm_gen.
308 G1CollectedHeap* g1h = G1CollectedHeap::heap();
309
310 GCTraceTime(Info, gc, phases) tm("Phase 4: Move objects", gc_timer());
311
312 G1SpaceCompactClosure blk;
313 g1h->heap_region_iterate(&blk);
314
315 }
316
317 void G1MarkSweep::enable_archive_object_check() {
318 assert(!_archive_check_enabled, "archive range check already enabled");
319 _archive_check_enabled = true;
320 size_t length = Universe::heap()->max_capacity();
321 _archive_region_map.initialize((HeapWord*)Universe::heap()->base(),
322 (HeapWord*)Universe::heap()->base() + length,
323 HeapRegion::GrainBytes);
324 }
325
326 void G1MarkSweep::set_range_archive(MemRegion range, bool is_archive) {
327 assert(_archive_check_enabled, "archive range check not enabled");
328 _archive_region_map.set_by_address(range, is_archive);
329 }
330
331 bool G1MarkSweep::in_archive_range(oop object) {
332 // This is the out-of-line part of is_archive_object test, done separately
333 // to avoid additional performance impact when the check is not enabled.
334 return _archive_region_map.get_by_address((HeapWord*)object);
335 }
336
337 void G1MarkSweep::prepare_compaction_work(G1PrepareCompactClosure* blk) {
338 G1CollectedHeap* g1h = G1CollectedHeap::heap();
339 g1h->heap_region_iterate(blk);
340 blk->update_sets();
341 }
342
|
300
301 void G1MarkSweep::mark_sweep_phase4() {
302 // All pointers are now adjusted, move objects accordingly
303
304 // The ValidateMarkSweep live oops tracking expects us to traverse spaces
305 // in the same order in phase2, phase3 and phase4. We don't quite do that
306 // here (code and comment not fixed for perm removal), so we tell the validate code
307 // to use a higher index (saved from phase2) when verifying perm_gen.
308 G1CollectedHeap* g1h = G1CollectedHeap::heap();
309
310 GCTraceTime(Info, gc, phases) tm("Phase 4: Move objects", gc_timer());
311
312 G1SpaceCompactClosure blk;
313 g1h->heap_region_iterate(&blk);
314
315 }
316
317 void G1MarkSweep::enable_archive_object_check() {
318 assert(!_archive_check_enabled, "archive range check already enabled");
319 _archive_check_enabled = true;
320 size_t length = GC::gc()->heap()->max_capacity();
321 _archive_region_map.initialize((HeapWord*)GC::gc()->heap()->base(),
322 (HeapWord*)GC::gc()->heap()->base() + length,
323 HeapRegion::GrainBytes);
324 }
325
326 void G1MarkSweep::set_range_archive(MemRegion range, bool is_archive) {
327 assert(_archive_check_enabled, "archive range check not enabled");
328 _archive_region_map.set_by_address(range, is_archive);
329 }
330
331 bool G1MarkSweep::in_archive_range(oop object) {
332 // This is the out-of-line part of is_archive_object test, done separately
333 // to avoid additional performance impact when the check is not enabled.
334 return _archive_region_map.get_by_address((HeapWord*)object);
335 }
336
337 void G1MarkSweep::prepare_compaction_work(G1PrepareCompactClosure* blk) {
338 G1CollectedHeap* g1h = G1CollectedHeap::heap();
339 g1h->heap_region_iterate(blk);
340 blk->update_sets();
341 }
342
|