7029458: G1: Add newly-reclaimed regions to the beginning of the region free list, not the end

What the synopsis says.

Reviewed-by: jwilhelm, iveresov, johnc
This commit is contained in:
Antonios Printezis 2011-03-29 22:36:16 -04:00
parent c2275649b7
commit 349d820dd1
5 changed files with 69 additions and 4 deletions

View file

@ -110,6 +110,23 @@ inline void HeapRegionSet::remove_with_proxy(HeapRegion* hr,
//////////////////// HeapRegionLinkedList ////////////////////
inline void HeapRegionLinkedList::add_as_head(HeapRegion* hr) {
hrs_assert_mt_safety_ok(this);
assert((length() == 0 && _head == NULL && _tail == NULL) ||
(length() > 0 && _head != NULL && _tail != NULL),
hrs_ext_msg(this, "invariant"));
// add_internal() will verify the region.
add_internal(hr);
// Now link the region.
if (_head != NULL) {
hr->set_next(_head);
} else {
_tail = hr;
}
_head = hr;
}
inline void HeapRegionLinkedList::add_as_tail(HeapRegion* hr) {
hrs_assert_mt_safety_ok(this);
assert((length() == 0 && _head == NULL && _tail == NULL) ||