src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page

        

*** 6654,6670 **** template <class T> void do_oop_work(T* p) { T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); HeapRegion* hr = _g1h->heap_region_containing(obj); ! assert(!hr->isHumongous(), "code root in humongous region?"); // HeapRegion::add_strong_code_root() avoids adding duplicate // entries but having duplicates is OK since we "mark" nmethods // as visited when we scan the strong code root lists during the GC. hr->add_strong_code_root(_nm); ! assert(hr->rem_set()->strong_code_roots_list_contains(_nm), "add failed?"); } } public: RegisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) : --- 6654,6675 ---- template <class T> void do_oop_work(T* p) { T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); HeapRegion* hr = _g1h->heap_region_containing(obj); ! assert(!hr->continuesHumongous(), ! err_msg("trying to add code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT ! " starting at "HR_FORMAT, ! _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); // HeapRegion::add_strong_code_root() avoids adding duplicate // entries but having duplicates is OK since we "mark" nmethods // as visited when we scan the strong code root lists during the GC. hr->add_strong_code_root(_nm); ! assert(hr->rem_set()->strong_code_roots_list_contains(_nm), ! err_msg("failed to add code root "PTR_FORMAT" to remembered set of region "HR_FORMAT, ! _nm, HR_FORMAT_PARAMS(hr))); } } public: RegisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) :
*** 6681,6693 **** template <class T> void do_oop_work(T* p) { T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); HeapRegion* hr = _g1h->heap_region_containing(obj); ! assert(!hr->isHumongous(), "code root in humongous region?"); hr->remove_strong_code_root(_nm); ! assert(!hr->rem_set()->strong_code_roots_list_contains(_nm), "remove failed?"); } } public: UnregisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) : --- 6686,6704 ---- template <class T> void do_oop_work(T* p) { T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); HeapRegion* hr = _g1h->heap_region_containing(obj); ! assert(!hr->continuesHumongous(), ! err_msg("trying to remove code root "PTR_FORMAT" in continuation of humongous region "HR_FORMAT ! " starting at "HR_FORMAT, ! _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); ! hr->remove_strong_code_root(_nm); ! assert(!hr->rem_set()->strong_code_roots_list_contains(_nm), ! err_msg("failed to remove code root "PTR_FORMAT" of region "HR_FORMAT, ! _nm, HR_FORMAT_PARAMS(hr))); } } public: UnregisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) :
*** 6714,6724 **** } class MigrateCodeRootsHeapRegionClosure: public HeapRegionClosure { public: bool doHeapRegion(HeapRegion *hr) { ! assert(!hr->isHumongous(), "humongous region in collection set?"); hr->migrate_strong_code_roots(); return false; } }; --- 6725,6737 ---- } class MigrateCodeRootsHeapRegionClosure: public HeapRegionClosure { public: bool doHeapRegion(HeapRegion *hr) { ! assert(!hr->isHumongous(), ! err_msg("humongous region "HR_FORMAT" should not have been added to collection set", ! HR_FORMAT_PARAMS(hr))); hr->migrate_strong_code_roots(); return false; } };
*** 6794,6806 **** MarkStrongCodeRootsHRClosure(G1CollectedHeap* g1h, uint worker_id) : _g1h(g1h), _worker_id(worker_id) {} bool doHeapRegion(HeapRegion *hr) { HeapRegionRemSet* hrrs = hr->rem_set(); ! if (hr->isHumongous()) { ! // Code roots should never be attached to a humongous region ! assert(hrrs->strong_code_roots_list_length() == 0, "sanity"); return false; } if (hr->in_collection_set()) { // Don't mark code roots into regions in the collection set here. --- 6807,6823 ---- MarkStrongCodeRootsHRClosure(G1CollectedHeap* g1h, uint worker_id) : _g1h(g1h), _worker_id(worker_id) {} bool doHeapRegion(HeapRegion *hr) { HeapRegionRemSet* hrrs = hr->rem_set(); ! if (hr->continuesHumongous()) { ! // Code roots should never be attached to a continuation of a humongous region ! assert(hrrs->strong_code_roots_list_length() == 0, ! err_msg("code roots should never be attached to continuations of humongous region "HR_FORMAT ! " starting at "HR_FORMAT", but has "INT32_FORMAT, ! HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()), ! hrrs->strong_code_roots_list_length())); return false; } if (hr->in_collection_set()) { // Don't mark code roots into regions in the collection set here.