comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 17773:8ee855b4e667

8036025: Sort the freelist in order to shrink the heap Summary: The free list is being maintained in a sorted fashion and old and humongous regions are allocated from the bottom of the heap while young regions are allocated at the top. Reviewed-by: tschatzl, mgerdin Contributed-by: jesper.wilhelmsson@oracle.com, staffan.friberg@oracle.com
author jwilhelm
date Fri, 28 Feb 2014 15:27:09 +0100
parents bc22cbb8b45a
children bfdf528be8e8
comparison
equal deleted inserted replaced
17763:6e7e363c5a8f 17773:8ee855b4e667
495 // This is the second level of trying to allocate a new region. If 495 // This is the second level of trying to allocate a new region. If
496 // new_region() didn't find a region on the free_list, this call will 496 // new_region() didn't find a region on the free_list, this call will
497 // check whether there's anything available on the 497 // check whether there's anything available on the
498 // secondary_free_list and/or wait for more regions to appear on 498 // secondary_free_list and/or wait for more regions to appear on
499 // that list, if _free_regions_coming is set. 499 // that list, if _free_regions_coming is set.
500 HeapRegion* new_region_try_secondary_free_list(); 500 HeapRegion* new_region_try_secondary_free_list(bool is_old);
501 501
502 // Try to allocate a single non-humongous HeapRegion sufficient for 502 // Try to allocate a single non-humongous HeapRegion sufficient for
503 // an allocation of the given word_size. If do_expand is true, 503 // an allocation of the given word_size. If do_expand is true,
504 // attempt to expand the heap if necessary to satisfy the allocation 504 // attempt to expand the heap if necessary to satisfy the allocation
505 // request. 505 // request. If the region is to be used as an old region or for a
506 HeapRegion* new_region(size_t word_size, bool do_expand); 506 // humongous object, set is_old to true. If not, to false.
507 HeapRegion* new_region(size_t word_size, bool is_old, bool do_expand);
507 508
508 // Attempt to satisfy a humongous allocation request of the given 509 // Attempt to satisfy a humongous allocation request of the given
509 // size by finding a contiguous set of free regions of num_regions 510 // size by finding a contiguous set of free regions of num_regions
510 // length and remove them from the master free list. Return the 511 // length and remove them from the master free list. Return the
511 // index of the first region or G1_NULL_HRS_INDEX if the search 512 // index of the first region or G1_NULL_HRS_INDEX if the search
1244 #endif // ASSERT 1245 #endif // ASSERT
1245 1246
1246 // Wrapper for the region list operations that can be called from 1247 // Wrapper for the region list operations that can be called from
1247 // methods outside this class. 1248 // methods outside this class.
1248 1249
1249 void secondary_free_list_add_as_tail(FreeRegionList* list) { 1250 void secondary_free_list_add(FreeRegionList* list) {
1250 _secondary_free_list.add_as_tail(list); 1251 _secondary_free_list.add_ordered(list);
1251 } 1252 }
1252 1253
1253 void append_secondary_free_list() { 1254 void append_secondary_free_list() {
1254 _free_list.add_as_head(&_secondary_free_list); 1255 _free_list.add_ordered(&_secondary_free_list);
1255 } 1256 }
1256 1257
1257 void append_secondary_free_list_if_not_empty_with_lock() { 1258 void append_secondary_free_list_if_not_empty_with_lock() {
1258 // If the secondary free list looks empty there's no reason to 1259 // If the secondary free list looks empty there's no reason to
1259 // take the lock and then try to append it. 1260 // take the lock and then try to append it.