27 |
27 |
28 #include "gc/g1/heapRegionSet.hpp" |
28 #include "gc/g1/heapRegionSet.hpp" |
29 |
29 |
30 inline void HeapRegionSetBase::add(HeapRegion* hr) { |
30 inline void HeapRegionSetBase::add(HeapRegion* hr) { |
31 check_mt_safety(); |
31 check_mt_safety(); |
32 assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u")); |
32 assert(hr->containing_set() == NULL, "%s", hrs_ext_msg(this, "should not already have a containing set %u").buffer()); |
33 assert(hr->next() == NULL, hrs_ext_msg(this, "should not already be linked")); |
33 assert(hr->next() == NULL, "%s", hrs_ext_msg(this, "should not already be linked").buffer()); |
34 assert(hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked")); |
34 assert(hr->prev() == NULL, "%s", hrs_ext_msg(this, "should not already be linked").buffer()); |
35 |
35 |
36 _count.increment(1u, hr->capacity()); |
36 _count.increment(1u, hr->capacity()); |
37 hr->set_containing_set(this); |
37 hr->set_containing_set(this); |
38 verify_region(hr); |
38 verify_region(hr); |
39 } |
39 } |
40 |
40 |
41 inline void HeapRegionSetBase::remove(HeapRegion* hr) { |
41 inline void HeapRegionSetBase::remove(HeapRegion* hr) { |
42 check_mt_safety(); |
42 check_mt_safety(); |
43 verify_region(hr); |
43 verify_region(hr); |
44 assert(hr->next() == NULL, hrs_ext_msg(this, "should already be unlinked")); |
44 assert(hr->next() == NULL, "%s", hrs_ext_msg(this, "should already be unlinked").buffer()); |
45 assert(hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked")); |
45 assert(hr->prev() == NULL, "%s", hrs_ext_msg(this, "should already be unlinked").buffer()); |
46 |
46 |
47 hr->set_containing_set(NULL); |
47 hr->set_containing_set(NULL); |
48 assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition")); |
48 assert(_count.length() > 0, "%s", hrs_ext_msg(this, "pre-condition").buffer()); |
49 _count.decrement(1u, hr->capacity()); |
49 _count.decrement(1u, hr->capacity()); |
50 } |
50 } |
51 |
51 |
52 inline void FreeRegionList::add_ordered(HeapRegion* hr) { |
52 inline void FreeRegionList::add_ordered(HeapRegion* hr) { |
53 assert((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) || |
53 assert((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) || |
54 (length() > 0 && _head != NULL && _tail != NULL), |
54 (length() > 0 && _head != NULL && _tail != NULL), |
55 hrs_ext_msg(this, "invariant")); |
55 "%s", hrs_ext_msg(this, "invariant").buffer()); |
56 // add() will verify the region and check mt safety. |
56 // add() will verify the region and check mt safety. |
57 add(hr); |
57 add(hr); |
58 |
58 |
59 // Now link the region |
59 // Now link the region |
60 if (_head != NULL) { |
60 if (_head != NULL) { |