Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/heapRegionSet.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 | 1216415d8e35 |
children | 8aae2050e83e |
comparison
equal
deleted
inserted
replaced
2431:02f49b66361a | 2432:455328d90876 |
---|---|
259 | 259 |
260 void HeapRegionLinkedList::fill_in_ext_msg_extra(hrs_ext_msg* msg) { | 260 void HeapRegionLinkedList::fill_in_ext_msg_extra(hrs_ext_msg* msg) { |
261 msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, head(), tail()); | 261 msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, head(), tail()); |
262 } | 262 } |
263 | 263 |
264 void HeapRegionLinkedList::add_as_head(HeapRegionLinkedList* from_list) { | |
265 hrs_assert_mt_safety_ok(this); | |
266 hrs_assert_mt_safety_ok(from_list); | |
267 | |
268 verify_optional(); | |
269 from_list->verify_optional(); | |
270 | |
271 if (from_list->is_empty()) return; | |
272 | |
273 #ifdef ASSERT | |
274 HeapRegionLinkedListIterator iter(from_list); | |
275 while (iter.more_available()) { | |
276 HeapRegion* hr = iter.get_next(); | |
277 // In set_containing_set() we check that we either set the value | |
278 // from NULL to non-NULL or vice versa to catch bugs. So, we have | |
279 // to NULL it first before setting it to the value. | |
280 hr->set_containing_set(NULL); | |
281 hr->set_containing_set(this); | |
282 } | |
283 #endif // ASSERT | |
284 | |
285 if (_head != NULL) { | |
286 assert(length() > 0 && _tail != NULL, hrs_ext_msg(this, "invariant")); | |
287 from_list->_tail->set_next(_head); | |
288 } else { | |
289 assert(length() == 0 && _head == NULL, hrs_ext_msg(this, "invariant")); | |
290 _tail = from_list->_tail; | |
291 } | |
292 _head = from_list->_head; | |
293 | |
294 _length += from_list->length(); | |
295 _region_num += from_list->region_num(); | |
296 _total_used_bytes += from_list->total_used_bytes(); | |
297 from_list->clear(); | |
298 | |
299 verify_optional(); | |
300 from_list->verify_optional(); | |
301 } | |
302 | |
264 void HeapRegionLinkedList::add_as_tail(HeapRegionLinkedList* from_list) { | 303 void HeapRegionLinkedList::add_as_tail(HeapRegionLinkedList* from_list) { |
265 hrs_assert_mt_safety_ok(this); | 304 hrs_assert_mt_safety_ok(this); |
266 hrs_assert_mt_safety_ok(from_list); | 305 hrs_assert_mt_safety_ok(from_list); |
267 | 306 |
268 verify_optional(); | 307 verify_optional(); |