Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 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 | f53edbc2b728 |
children | 14bd75c9dbfa |
comparison
equal
deleted
inserted
replaced
17763:6e7e363c5a8f | 17773:8ee855b4e667 |
---|---|
1927 HeapRegion* hr = iter.get_next(); | 1927 HeapRegion* hr = iter.get_next(); |
1928 hr_printer->cleanup(hr); | 1928 hr_printer->cleanup(hr); |
1929 } | 1929 } |
1930 } | 1930 } |
1931 | 1931 |
1932 _cleanup_list->add_as_tail(&local_cleanup_list); | 1932 _cleanup_list->add_ordered(&local_cleanup_list); |
1933 assert(local_cleanup_list.is_empty(), "post-condition"); | 1933 assert(local_cleanup_list.is_empty(), "post-condition"); |
1934 | 1934 |
1935 HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task); | 1935 HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task); |
1936 } | 1936 } |
1937 } | 1937 } |
2156 | 2156 |
2157 // Noone else should be accessing the _cleanup_list at this point, | 2157 // Noone else should be accessing the _cleanup_list at this point, |
2158 // so it's not necessary to take any locks | 2158 // so it's not necessary to take any locks |
2159 while (!_cleanup_list.is_empty()) { | 2159 while (!_cleanup_list.is_empty()) { |
2160 HeapRegion* hr = _cleanup_list.remove_head(); | 2160 HeapRegion* hr = _cleanup_list.remove_head(); |
2161 assert(hr != NULL, "the list was not empty"); | 2161 assert(hr != NULL, "Got NULL from a non-empty list"); |
2162 hr->par_clear(); | 2162 hr->par_clear(); |
2163 tmp_free_list.add_as_tail(hr); | 2163 tmp_free_list.add_ordered(hr); |
2164 | 2164 |
2165 // Instead of adding one region at a time to the secondary_free_list, | 2165 // Instead of adding one region at a time to the secondary_free_list, |
2166 // we accumulate them in the local list and move them a few at a | 2166 // we accumulate them in the local list and move them a few at a |
2167 // time. This also cuts down on the number of notify_all() calls | 2167 // time. This also cuts down on the number of notify_all() calls |
2168 // we do during this process. We'll also append the local list when | 2168 // we do during this process. We'll also append the local list when |
2178 _cleanup_list.length()); | 2178 _cleanup_list.length()); |
2179 } | 2179 } |
2180 | 2180 |
2181 { | 2181 { |
2182 MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag); | 2182 MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag); |
2183 g1h->secondary_free_list_add_as_tail(&tmp_free_list); | 2183 g1h->secondary_free_list_add(&tmp_free_list); |
2184 SecondaryFreeList_lock->notify_all(); | 2184 SecondaryFreeList_lock->notify_all(); |
2185 } | 2185 } |
2186 | 2186 |
2187 if (G1StressConcRegionFreeing) { | 2187 if (G1StressConcRegionFreeing) { |
2188 for (uintx i = 0; i < G1StressConcRegionFreeingDelayMillis; ++i) { | 2188 for (uintx i = 0; i < G1StressConcRegionFreeingDelayMillis; ++i) { |