< prev index next >

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

Print this page

        

*** 5304,5316 **** assert(free_list != NULL, "pre-condition"); hr->clear_humongous(); free_region(hr, free_list, par); } ! void G1CollectedHeap::remove_from_old_sets(const HeapRegionSetCount& old_regions_removed, ! const HeapRegionSetCount& humongous_regions_removed) { ! if (old_regions_removed.length() > 0 || humongous_regions_removed.length() > 0) { MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag); _old_set.bulk_remove(old_regions_removed); _humongous_set.bulk_remove(humongous_regions_removed); } --- 5304,5316 ---- assert(free_list != NULL, "pre-condition"); hr->clear_humongous(); free_region(hr, free_list, par); } ! void G1CollectedHeap::remove_from_old_sets(const uint old_regions_removed, ! const uint humongous_regions_removed) { ! if (old_regions_removed > 0 || humongous_regions_removed > 0) { MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag); _old_set.bulk_remove(old_regions_removed); _humongous_set.bulk_remove(humongous_regions_removed); }
*** 5695,5710 **** class G1FreeHumongousRegionClosure : public HeapRegionClosure { private: FreeRegionList* _free_region_list; HeapRegionSet* _proxy_set; ! HeapRegionSetCount _humongous_regions_removed; size_t _freed_bytes; public: G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) : ! _free_region_list(free_region_list), _humongous_regions_removed(), _freed_bytes(0) { } virtual bool doHeapRegion(HeapRegion* r) { if (!r->is_starts_humongous()) { return false; --- 5695,5710 ---- class G1FreeHumongousRegionClosure : public HeapRegionClosure { private: FreeRegionList* _free_region_list; HeapRegionSet* _proxy_set; ! uint _humongous_regions_removed; size_t _freed_bytes; public: G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) : ! _free_region_list(free_region_list), _humongous_regions_removed(0), _freed_bytes(0) { } virtual bool doHeapRegion(HeapRegion* r) { if (!r->is_starts_humongous()) { return false;
*** 5785,5813 **** } do { HeapRegion* next = g1h->next_region_in_humongous(r); _freed_bytes += r->used(); r->set_containing_set(NULL); ! _humongous_regions_removed.increment(1u, r->capacity()); g1h->free_humongous_region(r, _free_region_list, false); r = next; } while (r != NULL); return false; } ! HeapRegionSetCount& humongous_free_count() { return _humongous_regions_removed; } size_t bytes_freed() const { return _freed_bytes; } - - size_t humongous_reclaimed() const { - return _humongous_regions_removed.length(); - } }; void G1CollectedHeap::eagerly_reclaim_humongous_regions() { assert_at_safepoint(true); --- 5785,5809 ---- } do { HeapRegion* next = g1h->next_region_in_humongous(r); _freed_bytes += r->used(); r->set_containing_set(NULL); ! _humongous_regions_removed++; g1h->free_humongous_region(r, _free_region_list, false); r = next; } while (r != NULL); return false; } ! uint humongous_free_count() { return _humongous_regions_removed; } size_t bytes_freed() const { return _freed_bytes; } }; void G1CollectedHeap::eagerly_reclaim_humongous_regions() { assert_at_safepoint(true);
*** 5822,5833 **** FreeRegionList local_cleanup_list("Local Humongous Cleanup List"); G1FreeHumongousRegionClosure cl(&local_cleanup_list); heap_region_iterate(&cl); ! HeapRegionSetCount empty_set; ! remove_from_old_sets(empty_set, cl.humongous_free_count()); G1HRPrinter* hrp = hr_printer(); if (hrp->is_active()) { FreeRegionListIterator iter(&local_cleanup_list); while (iter.more_available()) { --- 5818,5828 ---- FreeRegionList local_cleanup_list("Local Humongous Cleanup List"); G1FreeHumongousRegionClosure cl(&local_cleanup_list); heap_region_iterate(&cl); ! remove_from_old_sets(0, cl.humongous_free_count()); G1HRPrinter* hrp = hr_printer(); if (hrp->is_active()) { FreeRegionListIterator iter(&local_cleanup_list); while (iter.more_available()) {
*** 5838,5848 **** prepend_to_freelist(&local_cleanup_list); decrement_summary_bytes(cl.bytes_freed()); g1_policy()->phase_times()->record_fast_reclaim_humongous_time_ms((os::elapsedTime() - start_time) * 1000.0, ! cl.humongous_reclaimed()); } // This routine is similar to the above but does not record // any policy statistics or update free lists; we are abandoning // the current incremental collection set in preparation of a --- 5833,5843 ---- prepend_to_freelist(&local_cleanup_list); decrement_summary_bytes(cl.bytes_freed()); g1_policy()->phase_times()->record_fast_reclaim_humongous_time_ms((os::elapsedTime() - start_time) * 1000.0, ! cl.humongous_free_count()); } // This routine is similar to the above but does not record // any policy statistics or update free lists; we are abandoning // the current incremental collection set in preparation of a
*** 6199,6211 **** HeapRegionSet* _old_set; HeapRegionSet* _humongous_set; HeapRegionManager* _hrm; public: ! HeapRegionSetCount _old_count; ! HeapRegionSetCount _humongous_count; ! HeapRegionSetCount _free_count; VerifyRegionListsClosure(HeapRegionSet* old_set, HeapRegionSet* humongous_set, HeapRegionManager* hrm) : _old_set(old_set), _humongous_set(humongous_set), _hrm(hrm), --- 6194,6206 ---- HeapRegionSet* _old_set; HeapRegionSet* _humongous_set; HeapRegionManager* _hrm; public: ! uint _old_count; ! uint _humongous_count; ! uint _free_count; VerifyRegionListsClosure(HeapRegionSet* old_set, HeapRegionSet* humongous_set, HeapRegionManager* hrm) : _old_set(old_set), _humongous_set(humongous_set), _hrm(hrm),
*** 6214,6251 **** bool doHeapRegion(HeapRegion* hr) { if (hr->is_young()) { // TODO } else if (hr->is_humongous()) { assert(hr->containing_set() == _humongous_set, "Heap region %u is humongous but not in humongous set.", hr->hrm_index()); ! _humongous_count.increment(1u, hr->capacity()); } else if (hr->is_empty()) { assert(_hrm->is_free(hr), "Heap region %u is empty but not on the free list.", hr->hrm_index()); ! _free_count.increment(1u, hr->capacity()); } else if (hr->is_old()) { assert(hr->containing_set() == _old_set, "Heap region %u is old but not in the old set.", hr->hrm_index()); ! _old_count.increment(1u, hr->capacity()); } else { // There are no other valid region types. Check for one invalid // one we can identify: pinned without old or humongous set. assert(!hr->is_pinned(), "Heap region %u is pinned but not old (archive) or humongous.", hr->hrm_index()); ShouldNotReachHere(); } return false; } void verify_counts(HeapRegionSet* old_set, HeapRegionSet* humongous_set, HeapRegionManager* free_list) { ! guarantee(old_set->length() == _old_count.length(), "Old set count mismatch. Expected %u, actual %u.", old_set->length(), _old_count.length()); ! guarantee(old_set->total_capacity_bytes() == _old_count.capacity(), "Old set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, ! old_set->total_capacity_bytes(), _old_count.capacity()); ! ! guarantee(humongous_set->length() == _humongous_count.length(), "Hum set count mismatch. Expected %u, actual %u.", humongous_set->length(), _humongous_count.length()); ! guarantee(humongous_set->total_capacity_bytes() == _humongous_count.capacity(), "Hum set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, ! humongous_set->total_capacity_bytes(), _humongous_count.capacity()); ! ! guarantee(free_list->num_free_regions() == _free_count.length(), "Free list count mismatch. Expected %u, actual %u.", free_list->num_free_regions(), _free_count.length()); ! guarantee(free_list->total_capacity_bytes() == _free_count.capacity(), "Free list capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT, ! free_list->total_capacity_bytes(), _free_count.capacity()); } }; void G1CollectedHeap::verify_region_sets() { assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); --- 6209,6238 ---- bool doHeapRegion(HeapRegion* hr) { if (hr->is_young()) { // TODO } else if (hr->is_humongous()) { assert(hr->containing_set() == _humongous_set, "Heap region %u is humongous but not in humongous set.", hr->hrm_index()); ! _humongous_count++; } else if (hr->is_empty()) { assert(_hrm->is_free(hr), "Heap region %u is empty but not on the free list.", hr->hrm_index()); ! _free_count++; } else if (hr->is_old()) { assert(hr->containing_set() == _old_set, "Heap region %u is old but not in the old set.", hr->hrm_index()); ! _old_count++; } else { // There are no other valid region types. Check for one invalid // one we can identify: pinned without old or humongous set. assert(!hr->is_pinned(), "Heap region %u is pinned but not old (archive) or humongous.", hr->hrm_index()); ShouldNotReachHere(); } return false; } void verify_counts(HeapRegionSet* old_set, HeapRegionSet* humongous_set, HeapRegionManager* free_list) { ! guarantee(old_set->length() == _old_count, "Old set count mismatch. Expected %u, actual %u.", old_set->length(), _old_count); ! guarantee(humongous_set->length() == _humongous_count, "Hum set count mismatch. Expected %u, actual %u.", humongous_set->length(), _humongous_count); ! guarantee(free_list->num_free_regions() == _free_count, "Free list count mismatch. Expected %u, actual %u.", free_list->num_free_regions(), _free_count); } }; void G1CollectedHeap::verify_region_sets() { assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
< prev index next >