493 young_gen->from_space()->clear(SpaceDecorator::Mangle);
494 young_gen->swap_spaces();
495
496 size_t survived = young_gen->from_space()->used_in_bytes();
497 size_t promoted = old_gen->used_in_bytes() - old_gen_used_before;
498 size_policy->update_averages(_survivor_overflow, survived, promoted);
499
500 // A successful scavenge should restart the GC time limit count which is
501 // for full GC's.
502 size_policy->reset_gc_overhead_limit_count();
503 if (UseAdaptiveSizePolicy) {
504 // Calculate the new survivor size and tenuring threshold
505
506 if (PrintAdaptiveSizePolicy) {
507 gclog_or_tty->print("AdaptiveSizeStart: ");
508 gclog_or_tty->stamp();
509 gclog_or_tty->print_cr(" collection: %d ",
510 heap->total_collections());
511
512 if (Verbose) {
513 gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
514 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
515 }
516 }
517
518
519 if (UsePerfData) {
520 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
521 counters->update_old_eden_size(
522 size_policy->calculated_eden_size_in_bytes());
523 counters->update_old_promo_size(
524 size_policy->calculated_promo_size_in_bytes());
525 counters->update_old_capacity(old_gen->capacity_in_bytes());
526 counters->update_young_capacity(young_gen->capacity_in_bytes());
527 counters->update_survived(survived);
528 counters->update_promoted(promoted);
529 counters->update_survivor_overflowed(_survivor_overflow);
530 }
531
532 size_t max_young_size = young_gen->max_size();
533
711 return !promotion_failure_occurred;
712 }
713
714 // This method iterates over all objects in the young generation,
715 // unforwarding markOops. It then restores any preserved mark oops,
716 // and clears the _preserved_mark_stack.
717 void PSScavenge::clean_up_failed_promotion() {
718 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
719 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
720
721 PSYoungGen* young_gen = heap->young_gen();
722
723 {
724 ResourceMark rm;
725
726 // Unforward all pointers in the young gen.
727 PSPromotionFailedClosure unforward_closure;
728 young_gen->object_iterate(&unforward_closure);
729
730 if (PrintGC && Verbose) {
731 gclog_or_tty->print_cr("Restoring %d marks", _preserved_oop_stack.size());
732 }
733
734 // Restore any saved marks.
735 while (!_preserved_oop_stack.is_empty()) {
736 oop obj = _preserved_oop_stack.pop();
737 markOop mark = _preserved_mark_stack.pop();
738 obj->set_mark(mark);
739 }
740
741 // Clear the preserved mark and oop stack caches.
742 _preserved_mark_stack.clear(true);
743 _preserved_oop_stack.clear(true);
744 }
745
746 // Reset the PromotionFailureALot counters.
747 NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
748 }
749
750 // This method is called whenever an attempt to promote an object
751 // fails. Some markOops will need preservation, some will not. Note
|
493 young_gen->from_space()->clear(SpaceDecorator::Mangle);
494 young_gen->swap_spaces();
495
496 size_t survived = young_gen->from_space()->used_in_bytes();
497 size_t promoted = old_gen->used_in_bytes() - old_gen_used_before;
498 size_policy->update_averages(_survivor_overflow, survived, promoted);
499
500 // A successful scavenge should restart the GC time limit count which is
501 // for full GC's.
502 size_policy->reset_gc_overhead_limit_count();
503 if (UseAdaptiveSizePolicy) {
504 // Calculate the new survivor size and tenuring threshold
505
506 if (PrintAdaptiveSizePolicy) {
507 gclog_or_tty->print("AdaptiveSizeStart: ");
508 gclog_or_tty->stamp();
509 gclog_or_tty->print_cr(" collection: %d ",
510 heap->total_collections());
511
512 if (Verbose) {
513 gclog_or_tty->print("old_gen_capacity: " SIZE_FORMAT
514 " young_gen_capacity: " SIZE_FORMAT,
515 old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
516 }
517 }
518
519
520 if (UsePerfData) {
521 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
522 counters->update_old_eden_size(
523 size_policy->calculated_eden_size_in_bytes());
524 counters->update_old_promo_size(
525 size_policy->calculated_promo_size_in_bytes());
526 counters->update_old_capacity(old_gen->capacity_in_bytes());
527 counters->update_young_capacity(young_gen->capacity_in_bytes());
528 counters->update_survived(survived);
529 counters->update_promoted(promoted);
530 counters->update_survivor_overflowed(_survivor_overflow);
531 }
532
533 size_t max_young_size = young_gen->max_size();
534
712 return !promotion_failure_occurred;
713 }
714
715 // This method iterates over all objects in the young generation,
716 // unforwarding markOops. It then restores any preserved mark oops,
717 // and clears the _preserved_mark_stack.
718 void PSScavenge::clean_up_failed_promotion() {
719 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
720 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
721
722 PSYoungGen* young_gen = heap->young_gen();
723
724 {
725 ResourceMark rm;
726
727 // Unforward all pointers in the young gen.
728 PSPromotionFailedClosure unforward_closure;
729 young_gen->object_iterate(&unforward_closure);
730
731 if (PrintGC && Verbose) {
732 gclog_or_tty->print_cr("Restoring " SIZE_FORMAT " marks", _preserved_oop_stack.size());
733 }
734
735 // Restore any saved marks.
736 while (!_preserved_oop_stack.is_empty()) {
737 oop obj = _preserved_oop_stack.pop();
738 markOop mark = _preserved_mark_stack.pop();
739 obj->set_mark(mark);
740 }
741
742 // Clear the preserved mark and oop stack caches.
743 _preserved_mark_stack.clear(true);
744 _preserved_oop_stack.clear(true);
745 }
746
747 // Reset the PromotionFailureALot counters.
748 NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
749 }
750
751 // This method is called whenever an attempt to promote an object
752 // fails. Some markOops will need preservation, some will not. Note
|