comparison src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @ 263:12eea04c8b06

6672698: mangle_unused_area() should not remangle the entire heap at each collection. Summary: Maintain a high water mark for the allocations in a space and mangle only up to that high water mark. Reviewed-by: ysr, apetrusenko
author jmasa
date Wed, 09 Jul 2008 15:08:55 -0700
parents ba764ed4b6f2
children 850fdf70db2b
comparison
equal deleted inserted replaced
225:286bee59f34b 263:12eea04c8b06
263 UseAdaptiveSizePolicyWithSystemGC) { 263 UseAdaptiveSizePolicyWithSystemGC) {
264 // Gather the feedback data for eden occupancy. 264 // Gather the feedback data for eden occupancy.
265 young_gen->eden_space()->accumulate_statistics(); 265 young_gen->eden_space()->accumulate_statistics();
266 } 266 }
267 267
268 if (ZapUnusedHeapArea) {
269 // Save information needed to minimize mangling
270 heap->record_gen_tops_before_GC();
271 }
272
268 if (PrintHeapAtGC) { 273 if (PrintHeapAtGC) {
269 Universe::print_heap_before_gc(); 274 Universe::print_heap_before_gc();
270 } 275 }
271 276
272 assert(!NeverTenure || _tenuring_threshold == markOopDesc::max_age + 1, "Sanity"); 277 assert(!NeverTenure || _tenuring_threshold == markOopDesc::max_age + 1, "Sanity");
313 } 318 }
314 319
315 if (!ScavengeWithObjectsInToSpace) { 320 if (!ScavengeWithObjectsInToSpace) {
316 assert(young_gen->to_space()->is_empty(), 321 assert(young_gen->to_space()->is_empty(),
317 "Attempt to scavenge with live objects in to_space"); 322 "Attempt to scavenge with live objects in to_space");
318 young_gen->to_space()->clear(); 323 young_gen->to_space()->clear(SpaceDecorator::Mangle);
319 } else if (ZapUnusedHeapArea) { 324 } else if (ZapUnusedHeapArea) {
320 young_gen->to_space()->mangle_unused_area(); 325 young_gen->to_space()->mangle_unused_area();
321 } 326 }
322 save_to_space_top_before_gc(); 327 save_to_space_top_before_gc();
323 328
435 // implicitly saying it's mutator time). 440 // implicitly saying it's mutator time).
436 size_policy->minor_collection_end(gc_cause); 441 size_policy->minor_collection_end(gc_cause);
437 442
438 if (!promotion_failure_occurred) { 443 if (!promotion_failure_occurred) {
439 // Swap the survivor spaces. 444 // Swap the survivor spaces.
440 young_gen->eden_space()->clear(); 445
441 young_gen->from_space()->clear(); 446
447 young_gen->eden_space()->clear(SpaceDecorator::Mangle);
448 young_gen->from_space()->clear(SpaceDecorator::Mangle);
442 young_gen->swap_spaces(); 449 young_gen->swap_spaces();
443 450
444 size_t survived = young_gen->from_space()->used_in_bytes(); 451 size_t survived = young_gen->from_space()->used_in_bytes();
445 size_t promoted = old_gen->used_in_bytes() - old_gen_used_before; 452 size_t promoted = old_gen->used_in_bytes() - old_gen_used_before;
446 size_policy->update_averages(_survivor_overflow, survived, promoted); 453 size_policy->update_averages(_survivor_overflow, survived, promoted);
598 605
599 if (PrintHeapAtGC) { 606 if (PrintHeapAtGC) {
600 Universe::print_heap_after_gc(); 607 Universe::print_heap_after_gc();
601 } 608 }
602 609
610 if (ZapUnusedHeapArea) {
611 young_gen->eden_space()->check_mangled_unused_area_complete();
612 young_gen->from_space()->check_mangled_unused_area_complete();
613 young_gen->to_space()->check_mangled_unused_area_complete();
614 }
615
603 scavenge_exit.update(); 616 scavenge_exit.update();
604 617
605 if (PrintGCTaskTimeStamps) { 618 if (PrintGCTaskTimeStamps) {
606 tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " INT64_FORMAT, 619 tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " INT64_FORMAT,
607 scavenge_entry.ticks(), scavenge_midpoint.ticks(), 620 scavenge_entry.ticks(), scavenge_midpoint.ticks(),