71 assert_heap_region_set(_verify_in_progress, "verification should be in progress");
72
73 _verify_in_progress = false;
74 }
75
76 void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
77 out->cr();
78 out->print_cr("Set: %s (" PTR_FORMAT ")", name(), p2i(this));
79 out->print_cr(" Region Assumptions");
80 out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous()));
81 out->print_cr(" free : %s", BOOL_TO_STR(regions_free()));
82 out->print_cr(" Attributes");
83 out->print_cr(" length : %14u", length());
84 out->print_cr(" total capacity : " SIZE_FORMAT_W(14) " bytes",
85 total_capacity_bytes());
86 }
87
88 HeapRegionSetBase::HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker)
89 : _name(name), _verify_in_progress(false),
90 _is_humongous(humongous), _is_free(free), _mt_safety_checker(mt_safety_checker),
91 _count()
92 { }
93
94 void FreeRegionList::set_unrealistically_long_length(uint len) {
95 guarantee(_unrealistically_long_length == 0, "should only be set once");
96 _unrealistically_long_length = len;
97 }
98
99 void FreeRegionList::remove_all() {
100 check_mt_safety();
101 verify_optional();
102
103 HeapRegion* curr = _head;
104 while (curr != NULL) {
105 verify_region(curr);
106
107 HeapRegion* next = curr->next();
108 curr->set_next(NULL);
109 curr->set_prev(NULL);
110 curr->set_containing_set(NULL);
111 curr = next;
160 HeapRegion* next_from = curr_from->next();
161
162 curr_from->set_next(curr_to);
163 curr_from->set_prev(curr_to->prev());
164 if (curr_to->prev() == NULL) {
165 _head = curr_from;
166 } else {
167 curr_to->prev()->set_next(curr_from);
168 }
169 curr_to->set_prev(curr_from);
170
171 curr_from = next_from;
172 }
173 }
174
175 if (_tail->hrm_index() < from_list->_tail->hrm_index()) {
176 _tail = from_list->_tail;
177 }
178 }
179
180 _count.increment(from_list->length(), from_list->total_capacity_bytes());
181 from_list->clear();
182
183 verify_optional();
184 from_list->verify_optional();
185 }
186
187 void FreeRegionList::remove_starting_at(HeapRegion* first, uint num_regions) {
188 check_mt_safety();
189 assert_free_region_list(num_regions >= 1, "pre-condition");
190 assert_free_region_list(!is_empty(), "pre-condition");
191
192 verify_optional();
193 DEBUG_ONLY(uint old_length = length();)
194
195 HeapRegion* curr = first;
196 uint count = 0;
197 while (count < num_regions) {
198 verify_region(curr);
199 HeapRegion* next = curr->next();
200 HeapRegion* prev = curr->prev();
238 "new length: %u old length: %u num_regions: %u",
239 name(), length(), old_length, num_regions);
240
241 verify_optional();
242 }
243
244 void FreeRegionList::verify() {
245 // See comment in HeapRegionSetBase::verify() about MT safety and
246 // verification.
247 check_mt_safety();
248
249 // This will also do the basic verification too.
250 verify_start();
251
252 verify_list();
253
254 verify_end();
255 }
256
257 void FreeRegionList::clear() {
258 _count = HeapRegionSetCount();
259 _head = NULL;
260 _tail = NULL;
261 _last = NULL;
262 }
263
264 void FreeRegionList::print_on(outputStream* out, bool print_contents) {
265 HeapRegionSetBase::print_on(out, print_contents);
266 out->print_cr(" Linking");
267 out->print_cr(" head : " PTR_FORMAT, p2i(_head));
268 out->print_cr(" tail : " PTR_FORMAT, p2i(_tail));
269
270 if (print_contents) {
271 out->print_cr(" Contents");
272 FreeRegionListIterator iter(this);
273 while (iter.more_available()) {
274 HeapRegion* hr = iter.get_next();
275 hr->print_on(out);
276 }
277 }
278
|
71 assert_heap_region_set(_verify_in_progress, "verification should be in progress");
72
73 _verify_in_progress = false;
74 }
75
76 void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
77 out->cr();
78 out->print_cr("Set: %s (" PTR_FORMAT ")", name(), p2i(this));
79 out->print_cr(" Region Assumptions");
80 out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous()));
81 out->print_cr(" free : %s", BOOL_TO_STR(regions_free()));
82 out->print_cr(" Attributes");
83 out->print_cr(" length : %14u", length());
84 out->print_cr(" total capacity : " SIZE_FORMAT_W(14) " bytes",
85 total_capacity_bytes());
86 }
87
88 HeapRegionSetBase::HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker)
89 : _name(name), _verify_in_progress(false),
90 _is_humongous(humongous), _is_free(free), _mt_safety_checker(mt_safety_checker),
91 _length()
92 { }
93
94 void FreeRegionList::set_unrealistically_long_length(uint len) {
95 guarantee(_unrealistically_long_length == 0, "should only be set once");
96 _unrealistically_long_length = len;
97 }
98
99 void FreeRegionList::remove_all() {
100 check_mt_safety();
101 verify_optional();
102
103 HeapRegion* curr = _head;
104 while (curr != NULL) {
105 verify_region(curr);
106
107 HeapRegion* next = curr->next();
108 curr->set_next(NULL);
109 curr->set_prev(NULL);
110 curr->set_containing_set(NULL);
111 curr = next;
160 HeapRegion* next_from = curr_from->next();
161
162 curr_from->set_next(curr_to);
163 curr_from->set_prev(curr_to->prev());
164 if (curr_to->prev() == NULL) {
165 _head = curr_from;
166 } else {
167 curr_to->prev()->set_next(curr_from);
168 }
169 curr_to->set_prev(curr_from);
170
171 curr_from = next_from;
172 }
173 }
174
175 if (_tail->hrm_index() < from_list->_tail->hrm_index()) {
176 _tail = from_list->_tail;
177 }
178 }
179
180 _length += from_list->length();
181 from_list->clear();
182
183 verify_optional();
184 from_list->verify_optional();
185 }
186
187 void FreeRegionList::remove_starting_at(HeapRegion* first, uint num_regions) {
188 check_mt_safety();
189 assert_free_region_list(num_regions >= 1, "pre-condition");
190 assert_free_region_list(!is_empty(), "pre-condition");
191
192 verify_optional();
193 DEBUG_ONLY(uint old_length = length();)
194
195 HeapRegion* curr = first;
196 uint count = 0;
197 while (count < num_regions) {
198 verify_region(curr);
199 HeapRegion* next = curr->next();
200 HeapRegion* prev = curr->prev();
238 "new length: %u old length: %u num_regions: %u",
239 name(), length(), old_length, num_regions);
240
241 verify_optional();
242 }
243
244 void FreeRegionList::verify() {
245 // See comment in HeapRegionSetBase::verify() about MT safety and
246 // verification.
247 check_mt_safety();
248
249 // This will also do the basic verification too.
250 verify_start();
251
252 verify_list();
253
254 verify_end();
255 }
256
257 void FreeRegionList::clear() {
258 _length = 0;
259 _head = NULL;
260 _tail = NULL;
261 _last = NULL;
262 }
263
264 void FreeRegionList::print_on(outputStream* out, bool print_contents) {
265 HeapRegionSetBase::print_on(out, print_contents);
266 out->print_cr(" Linking");
267 out->print_cr(" head : " PTR_FORMAT, p2i(_head));
268 out->print_cr(" tail : " PTR_FORMAT, p2i(_tail));
269
270 if (print_contents) {
271 out->print_cr(" Contents");
272 FreeRegionListIterator iter(this);
273 while (iter.more_available()) {
274 HeapRegion* hr = iter.get_next();
275 hr->print_on(out);
276 }
277 }
278
|