comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 13062:28674af341ac

8027756: assert(!hr->isHumongous()) failed: code root in humongous region? Summary: Change checks for isHumongous() to continuesHumongous() as installing a code root for a humongous object is valid, but not for continuations of humongous objects. Cleaned up asserts. Reviewed-by: jmasa, tamao
author tschatzl
date Thu, 07 Nov 2013 15:17:10 +0100
parents 8f07aa079343
children 096c224171c4 86e6d691f2e1
comparison
equal deleted inserted replaced
13061:610be0309a79 13062:28674af341ac
6654 template <class T> void do_oop_work(T* p) { 6654 template <class T> void do_oop_work(T* p) {
6655 T heap_oop = oopDesc::load_heap_oop(p); 6655 T heap_oop = oopDesc::load_heap_oop(p);
6656 if (!oopDesc::is_null(heap_oop)) { 6656 if (!oopDesc::is_null(heap_oop)) {
6657 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); 6657 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
6658 HeapRegion* hr = _g1h->heap_region_containing(obj); 6658 HeapRegion* hr = _g1h->heap_region_containing(obj);
6659 assert(!hr->isHumongous(), "code root in humongous region?"); 6659 assert(!hr->continuesHumongous(),
6660 err_msg("trying to add code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT
6661 " starting at "HR_FORMAT,
6662 _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region())));
6660 6663
6661 // HeapRegion::add_strong_code_root() avoids adding duplicate 6664 // HeapRegion::add_strong_code_root() avoids adding duplicate
6662 // entries but having duplicates is OK since we "mark" nmethods 6665 // entries but having duplicates is OK since we "mark" nmethods
6663 // as visited when we scan the strong code root lists during the GC. 6666 // as visited when we scan the strong code root lists during the GC.
6664 hr->add_strong_code_root(_nm); 6667 hr->add_strong_code_root(_nm);
6665 assert(hr->rem_set()->strong_code_roots_list_contains(_nm), "add failed?"); 6668 assert(hr->rem_set()->strong_code_roots_list_contains(_nm),
6669 err_msg("failed to add code root "PTR_FORMAT" to remembered set of region "HR_FORMAT,
6670 _nm, HR_FORMAT_PARAMS(hr)));
6666 } 6671 }
6667 } 6672 }
6668 6673
6669 public: 6674 public:
6670 RegisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) : 6675 RegisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) :
6681 template <class T> void do_oop_work(T* p) { 6686 template <class T> void do_oop_work(T* p) {
6682 T heap_oop = oopDesc::load_heap_oop(p); 6687 T heap_oop = oopDesc::load_heap_oop(p);
6683 if (!oopDesc::is_null(heap_oop)) { 6688 if (!oopDesc::is_null(heap_oop)) {
6684 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); 6689 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
6685 HeapRegion* hr = _g1h->heap_region_containing(obj); 6690 HeapRegion* hr = _g1h->heap_region_containing(obj);
6686 assert(!hr->isHumongous(), "code root in humongous region?"); 6691 assert(!hr->continuesHumongous(),
6692 err_msg("trying to remove code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT
6693 " starting at "HR_FORMAT,
6694 _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region())));
6695
6687 hr->remove_strong_code_root(_nm); 6696 hr->remove_strong_code_root(_nm);
6688 assert(!hr->rem_set()->strong_code_roots_list_contains(_nm), "remove failed?"); 6697 assert(!hr->rem_set()->strong_code_roots_list_contains(_nm),
6698 err_msg("failed to remove code root "PTR_FORMAT" of region "HR_FORMAT,
6699 _nm, HR_FORMAT_PARAMS(hr)));
6689 } 6700 }
6690 } 6701 }
6691 6702
6692 public: 6703 public:
6693 UnregisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) : 6704 UnregisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) :
6714 } 6725 }
6715 6726
6716 class MigrateCodeRootsHeapRegionClosure: public HeapRegionClosure { 6727 class MigrateCodeRootsHeapRegionClosure: public HeapRegionClosure {
6717 public: 6728 public:
6718 bool doHeapRegion(HeapRegion *hr) { 6729 bool doHeapRegion(HeapRegion *hr) {
6719 assert(!hr->isHumongous(), "humongous region in collection set?"); 6730 assert(!hr->isHumongous(),
6731 err_msg("humongous region "HR_FORMAT" should not have been added to collection set",
6732 HR_FORMAT_PARAMS(hr)));
6720 hr->migrate_strong_code_roots(); 6733 hr->migrate_strong_code_roots();
6721 return false; 6734 return false;
6722 } 6735 }
6723 }; 6736 };
6724 6737
6794 MarkStrongCodeRootsHRClosure(G1CollectedHeap* g1h, uint worker_id) : 6807 MarkStrongCodeRootsHRClosure(G1CollectedHeap* g1h, uint worker_id) :
6795 _g1h(g1h), _worker_id(worker_id) {} 6808 _g1h(g1h), _worker_id(worker_id) {}
6796 6809
6797 bool doHeapRegion(HeapRegion *hr) { 6810 bool doHeapRegion(HeapRegion *hr) {
6798 HeapRegionRemSet* hrrs = hr->rem_set(); 6811 HeapRegionRemSet* hrrs = hr->rem_set();
6799 if (hr->isHumongous()) { 6812 if (hr->continuesHumongous()) {
6800 // Code roots should never be attached to a humongous region 6813 // Code roots should never be attached to a continuation of a humongous region
6801 assert(hrrs->strong_code_roots_list_length() == 0, "sanity"); 6814 assert(hrrs->strong_code_roots_list_length() == 0,
6815 err_msg("code roots should never be attached to continuations of humongous region "HR_FORMAT
6816 " starting at "HR_FORMAT", but has "INT32_FORMAT,
6817 HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()),
6818 hrrs->strong_code_roots_list_length()));
6802 return false; 6819 return false;
6803 } 6820 }
6804 6821
6805 if (hr->in_collection_set()) { 6822 if (hr->in_collection_set()) {
6806 // Don't mark code roots into regions in the collection set here. 6823 // Don't mark code roots into regions in the collection set here.