669 }
670
671 void DefNewGeneration::remove_forwarding_pointers() {
672 RemoveForwardedPointerClosure rspc;
673 eden()->object_iterate(&rspc);
674 from()->object_iterate(&rspc);
675 restore_preserved_marks();
676 }
677
678 void DefNewGeneration::restore_preserved_marks() {
679 _preserved_marks_set.restore(NULL);
680 }
681
682 void DefNewGeneration::handle_promotion_failure(oop old) {
683 log_debug(gc, promotion)("Promotion failure size = %d) ", old->size());
684
685 _promotion_failed = true;
686 _promotion_failed_info.register_copy_failure(old->size());
687 _preserved_marks_set.get()->push_if_necessary(old, old->mark());
688 // forward to self
689 old->forward_to(old);
690
691 _promo_failure_scan_stack.push(old);
692
693 if (!_promo_failure_drain_in_progress) {
694 // prevent recursion in copy_to_survivor_space()
695 _promo_failure_drain_in_progress = true;
696 drain_promo_failure_scan_stack();
697 _promo_failure_drain_in_progress = false;
698 }
699 }
700
701 oop DefNewGeneration::copy_to_survivor_space(oop old) {
702 assert(is_in_reserved(old) && !old->is_forwarded(),
703 "shouldn't be scavenging this oop");
704 size_t s = old->size();
705 oop obj = NULL;
706
707 // Try allocating obj in to-space (unless too old)
708 if (old->age() < tenuring_threshold()) {
709 obj = cast_to_oop(to()->allocate(s));
|
669 }
670
671 void DefNewGeneration::remove_forwarding_pointers() {
672 RemoveForwardedPointerClosure rspc;
673 eden()->object_iterate(&rspc);
674 from()->object_iterate(&rspc);
675 restore_preserved_marks();
676 }
677
678 void DefNewGeneration::restore_preserved_marks() {
679 _preserved_marks_set.restore(NULL);
680 }
681
682 void DefNewGeneration::handle_promotion_failure(oop old) {
683 log_debug(gc, promotion)("Promotion failure size = %d) ", old->size());
684
685 _promotion_failed = true;
686 _promotion_failed_info.register_copy_failure(old->size());
687 _preserved_marks_set.get()->push_if_necessary(old, old->mark());
688 // forward to self
689 old->forward_to_self();
690
691 _promo_failure_scan_stack.push(old);
692
693 if (!_promo_failure_drain_in_progress) {
694 // prevent recursion in copy_to_survivor_space()
695 _promo_failure_drain_in_progress = true;
696 drain_promo_failure_scan_stack();
697 _promo_failure_drain_in_progress = false;
698 }
699 }
700
701 oop DefNewGeneration::copy_to_survivor_space(oop old) {
702 assert(is_in_reserved(old) && !old->is_forwarded(),
703 "shouldn't be scavenging this oop");
704 size_t s = old->size();
705 oop obj = NULL;
706
707 // Try allocating obj in to-space (unless too old)
708 if (old->age() < tenuring_threshold()) {
709 obj = cast_to_oop(to()->allocate(s));
|