comparison src/share/vm/memory/defNewGeneration.cpp @ 1889:c766bae6c14d

6995045: assert(!gch->incremental_collection_failed()) failed: Error, defNewGeneration.cpp:827 Summary: Sharpened an assert, introduced in 6896603, that intended to check that the incremental_collection_failed() predicate on the heap was being reset "soon enough". Reviewed-by: jmasa
author ysr
date Thu, 28 Oct 2010 14:46:29 -0700
parents a7214d79fcf1
children 8d81b4a1d3e1
comparison
equal deleted inserted replaced
1888:a7214d79fcf1 1889:c766bae6c14d
807 } 807 }
808 return _next_gen->promotion_attempt_is_safe(used()); 808 return _next_gen->promotion_attempt_is_safe(used());
809 } 809 }
810 810
811 void DefNewGeneration::gc_epilogue(bool full) { 811 void DefNewGeneration::gc_epilogue(bool full) {
812 DEBUG_ONLY(static bool seen_incremental_collection_failed = false;)
813
814 assert(!GC_locker::is_active(), "We should not be executing here");
812 // Check if the heap is approaching full after a collection has 815 // Check if the heap is approaching full after a collection has
813 // been done. Generally the young generation is empty at 816 // been done. Generally the young generation is empty at
814 // a minimum at the end of a collection. If it is not, then 817 // a minimum at the end of a collection. If it is not, then
815 // the heap is approaching full. 818 // the heap is approaching full.
816 GenCollectedHeap* gch = GenCollectedHeap::heap(); 819 GenCollectedHeap* gch = GenCollectedHeap::heap();
817 if (full) { 820 if (full) {
818 assert(!GC_locker::is_active(), "We should not be executing here"); 821 DEBUG_ONLY(seen_incremental_collection_failed = false;)
819 if (!collection_attempt_is_safe()) { 822 if (!collection_attempt_is_safe()) {
820 gch->set_incremental_collection_failed(); // Slight lie: a full gc left us in that state 823 gch->set_incremental_collection_failed(); // Slight lie: a full gc left us in that state
821 set_should_allocate_from_space(); // we seem to be running out of space 824 set_should_allocate_from_space(); // we seem to be running out of space
822 } else { 825 } else {
823 gch->clear_incremental_collection_failed(); // We just did a full collection 826 gch->clear_incremental_collection_failed(); // We just did a full collection
824 clear_should_allocate_from_space(); // if set 827 clear_should_allocate_from_space(); // if set
825 } 828 }
826 } else { 829 } else {
827 assert(!gch->incremental_collection_failed(), "Error"); 830 #ifdef ASSERT
831 // It is possible that incremental_collection_failed() == true
832 // here, because an attempted scavenge did not succeed. The policy
833 // is normally expected to cause a full collection which should
834 // clear that condition, so we should not be here twice in a row
835 // with incremental_collection_failed() == true without having done
836 // a full collection in between.
837 if (!seen_incremental_collection_failed &&
838 gch->incremental_collection_failed()) {
839 seen_incremental_collection_failed = true;
840 } else if (seen_incremental_collection_failed) {
841 assert(!gch->incremental_collection_failed(), "Twice in a row");
842 seen_incremental_collection_failed = false;
843 }
844 #endif // ASSERT
828 } 845 }
829 846
830 if (ZapUnusedHeapArea) { 847 if (ZapUnusedHeapArea) {
831 eden()->check_mangled_unused_area_complete(); 848 eden()->check_mangled_unused_area_complete();
832 from()->check_mangled_unused_area_complete(); 849 from()->check_mangled_unused_area_complete();