comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 2432:455328d90876

7029458: G1: Add newly-reclaimed regions to the beginning of the region free list, not the end Summary: What the synopsis says. Reviewed-by: jwilhelm, iveresov, johnc
author tonyp
date Tue, 29 Mar 2011 22:36:16 -0400
parents 92da084fefc9
children abdfc822206f
comparison
equal deleted inserted replaced
2431:02f49b66361a 2432:455328d90876
3877 set_gc_alloc_region(ap, NULL); 3877 set_gc_alloc_region(ap, NULL);
3878 3878
3879 if (r->is_empty()) { 3879 if (r->is_empty()) {
3880 // We didn't actually allocate anything in it; let's just put 3880 // We didn't actually allocate anything in it; let's just put
3881 // it back on the free list. 3881 // it back on the free list.
3882 _free_list.add_as_tail(r); 3882 _free_list.add_as_head(r);
3883 } else if (_retain_gc_alloc_region[ap] && !totally) { 3883 } else if (_retain_gc_alloc_region[ap] && !totally) {
3884 // retain it so that we can use it at the beginning of the next GC 3884 // retain it so that we can use it at the beginning of the next GC
3885 _retained_gc_alloc_regions[ap] = r; 3885 _retained_gc_alloc_regions[ap] = r;
3886 } 3886 }
3887 } 3887 }
5011 assert(!hr->is_empty(), "the region should not be empty"); 5011 assert(!hr->is_empty(), "the region should not be empty");
5012 assert(free_list != NULL, "pre-condition"); 5012 assert(free_list != NULL, "pre-condition");
5013 5013
5014 *pre_used += hr->used(); 5014 *pre_used += hr->used();
5015 hr->hr_clear(par, true /* clear_space */); 5015 hr->hr_clear(par, true /* clear_space */);
5016 free_list->add_as_tail(hr); 5016 free_list->add_as_head(hr);
5017 } 5017 }
5018 5018
5019 void G1CollectedHeap::free_humongous_region(HeapRegion* hr, 5019 void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
5020 size_t* pre_used, 5020 size_t* pre_used,
5021 FreeRegionList* free_list, 5021 FreeRegionList* free_list,
5063 _summary_bytes_used, pre_used)); 5063 _summary_bytes_used, pre_used));
5064 _summary_bytes_used -= pre_used; 5064 _summary_bytes_used -= pre_used;
5065 } 5065 }
5066 if (free_list != NULL && !free_list->is_empty()) { 5066 if (free_list != NULL && !free_list->is_empty()) {
5067 MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag); 5067 MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
5068 _free_list.add_as_tail(free_list); 5068 _free_list.add_as_head(free_list);
5069 } 5069 }
5070 if (humongous_proxy_set != NULL && !humongous_proxy_set->is_empty()) { 5070 if (humongous_proxy_set != NULL && !humongous_proxy_set->is_empty()) {
5071 MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag); 5071 MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
5072 _humongous_set.update_from_proxy(humongous_proxy_set); 5072 _humongous_set.update_from_proxy(humongous_proxy_set);
5073 } 5073 }