< prev index next >
src/share/vm/gc/g1/heapRegionSet.cpp
Print this page
rev 8978 : imported patch remove_err_msg
rev 8979 : [mq]: vmerr_static
*** 35,52 ****
fill_in_ext_msg_extra(msg);
}
#ifndef PRODUCT
void HeapRegionSetBase::verify_region(HeapRegion* hr) {
! assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrm_index()));
! assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrm_index())); // currently we don't use these sets for young regions
! assert(hr->is_humongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrm_index(), name()));
! assert(hr->is_free() == regions_free(), err_msg("Wrong free state for region %u and set %s", hr->hrm_index(), name()));
! assert(!hr->is_free() || hr->is_empty(), err_msg("Free region %u is not empty for set %s", hr->hrm_index(), name()));
assert(!hr->is_empty() || hr->is_free() || hr->is_archive(),
! err_msg("Empty region %u is not free or archive for set %s", hr->hrm_index(), name()));
! assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrm_index()));
}
#endif
void HeapRegionSetBase::verify() {
// It's important that we also observe the MT safety protocol even
--- 35,52 ----
fill_in_ext_msg_extra(msg);
}
#ifndef PRODUCT
void HeapRegionSetBase::verify_region(HeapRegion* hr) {
! assert(hr->containing_set() == this, "Inconsistent containing set for %u", hr->hrm_index());
! assert(!hr->is_young(), "Adding young region %u", hr->hrm_index()); // currently we don't use these sets for young regions
! assert(hr->is_humongous() == regions_humongous(), "Wrong humongous state for region %u and set %s", hr->hrm_index(), name());
! assert(hr->is_free() == regions_free(), "Wrong free state for region %u and set %s", hr->hrm_index(), name());
! assert(!hr->is_free() || hr->is_empty(), "Free region %u is not empty for set %s", hr->hrm_index(), name());
assert(!hr->is_empty() || hr->is_free() || hr->is_archive(),
! "Empty region %u is not free or archive for set %s", hr->hrm_index(), name());
! assert(hr->rem_set()->verify_ready_for_par_iteration(), "Wrong iteration state %u", hr->hrm_index());
}
#endif
void HeapRegionSetBase::verify() {
// It's important that we also observe the MT safety protocol even
*** 55,72 ****
// verification might fail and send us on a wild goose chase.
check_mt_safety();
guarantee(( is_empty() && length() == 0 && total_capacity_bytes() == 0) ||
(!is_empty() && length() > 0 && total_capacity_bytes() > 0) ,
! hrs_ext_msg(this, "invariant"));
}
void HeapRegionSetBase::verify_start() {
// See comment in verify() about MT safety and verification.
check_mt_safety();
assert(!_verify_in_progress,
! hrs_ext_msg(this, "verification should not be in progress"));
// Do the basic verification first before we do the checks over the regions.
HeapRegionSetBase::verify();
_verify_in_progress = true;
--- 55,72 ----
// verification might fail and send us on a wild goose chase.
check_mt_safety();
guarantee(( is_empty() && length() == 0 && total_capacity_bytes() == 0) ||
(!is_empty() && length() > 0 && total_capacity_bytes() > 0) ,
! "%s", hrs_ext_msg(this, "invariant").buffer());
}
void HeapRegionSetBase::verify_start() {
// See comment in verify() about MT safety and verification.
check_mt_safety();
assert(!_verify_in_progress,
! "%s", hrs_ext_msg(this, "verification should not be in progress").buffer());
// Do the basic verification first before we do the checks over the regions.
HeapRegionSetBase::verify();
_verify_in_progress = true;
*** 74,84 ****
void HeapRegionSetBase::verify_end() {
// See comment in verify() about MT safety and verification.
check_mt_safety();
assert(_verify_in_progress,
! hrs_ext_msg(this, "verification should be in progress"));
_verify_in_progress = false;
}
void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
--- 74,84 ----
void HeapRegionSetBase::verify_end() {
// See comment in verify() about MT safety and verification.
check_mt_safety();
assert(_verify_in_progress,
! "%s", hrs_ext_msg(this, "verification should be in progress").buffer());
_verify_in_progress = false;
}
void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) {
*** 149,159 ****
hr->set_containing_set(this);
}
#endif // ASSERT
if (is_empty()) {
! assert(length() == 0 && _tail == NULL, hrs_ext_msg(this, "invariant"));
_head = from_list->_head;
_tail = from_list->_tail;
} else {
HeapRegion* curr_to = _head;
HeapRegion* curr_from = from_list->_head;
--- 149,159 ----
hr->set_containing_set(this);
}
#endif // ASSERT
if (is_empty()) {
! assert(length() == 0 && _tail == NULL, "%s", hrs_ext_msg(this, "invariant").buffer());
_head = from_list->_head;
_tail = from_list->_tail;
} else {
HeapRegion* curr_to = _head;
HeapRegion* curr_from = from_list->_head;
*** 196,207 ****
from_list->verify_optional();
}
void FreeRegionList::remove_starting_at(HeapRegion* first, uint num_regions) {
check_mt_safety();
! assert(num_regions >= 1, hrs_ext_msg(this, "pre-condition"));
! assert(!is_empty(), hrs_ext_msg(this, "pre-condition"));
verify_optional();
DEBUG_ONLY(uint old_length = length();)
HeapRegion* curr = first;
--- 196,207 ----
from_list->verify_optional();
}
void FreeRegionList::remove_starting_at(HeapRegion* first, uint num_regions) {
check_mt_safety();
! assert(num_regions >= 1, "%s", hrs_ext_msg(this, "pre-condition").buffer());
! assert(!is_empty(), "%s", hrs_ext_msg(this, "pre-condition").buffer());
verify_optional();
DEBUG_ONLY(uint old_length = length();)
HeapRegion* curr = first;
*** 210,235 ****
verify_region(curr);
HeapRegion* next = curr->next();
HeapRegion* prev = curr->prev();
assert(count < num_regions,
! hrs_err_msg("[%s] should not come across more regions "
"pending for removal than num_regions: %u",
! name(), num_regions));
if (prev == NULL) {
! assert(_head == curr, hrs_ext_msg(this, "invariant"));
_head = next;
} else {
! assert(_head != curr, hrs_ext_msg(this, "invariant"));
prev->set_next(next);
}
if (next == NULL) {
! assert(_tail == curr, hrs_ext_msg(this, "invariant"));
_tail = prev;
} else {
! assert(_tail != curr, hrs_ext_msg(this, "invariant"));
next->set_prev(prev);
}
if (_last = curr) {
_last = NULL;
}
--- 210,235 ----
verify_region(curr);
HeapRegion* next = curr->next();
HeapRegion* prev = curr->prev();
assert(count < num_regions,
! "%s", hrs_err_msg("[%s] should not come across more regions "
"pending for removal than num_regions: %u",
! name(), num_regions).buffer());
if (prev == NULL) {
! assert(_head == curr, "%s", hrs_ext_msg(this, "invariant").buffer());
_head = next;
} else {
! assert(_head != curr, "%s", hrs_ext_msg(this, "invariant").buffer());
prev->set_next(next);
}
if (next == NULL) {
! assert(_tail == curr, "%s", hrs_ext_msg(this, "invariant").buffer());
_tail = prev;
} else {
! assert(_tail != curr, "%s", hrs_ext_msg(this, "invariant").buffer());
next->set_prev(prev);
}
if (_last = curr) {
_last = NULL;
}
*** 241,256 ****
count++;
curr = next;
}
assert(count == num_regions,
! hrs_err_msg("[%s] count: %u should be == num_regions: %u",
! name(), count, num_regions));
assert(length() + num_regions == old_length,
! hrs_err_msg("[%s] new length should be consistent "
"new length: %u old length: %u num_regions: %u",
! name(), length(), old_length, num_regions));
verify_optional();
}
void FreeRegionList::verify() {
--- 241,256 ----
count++;
curr = next;
}
assert(count == num_regions,
! "%s", hrs_err_msg("[%s] count: %u should be == num_regions: %u",
! name(), count, num_regions).buffer());
assert(length() + num_regions == old_length,
! "%s", hrs_err_msg("[%s] new length should be consistent "
"new length: %u old length: %u num_regions: %u",
! name(), length(), old_length, num_regions).buffer());
verify_optional();
}
void FreeRegionList::verify() {
*** 303,314 ****
while (curr != NULL) {
verify_region(curr);
count++;
guarantee(count < _unrealistically_long_length,
! hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: " PTR_FORMAT " prev0: " PTR_FORMAT " " "prev1: " PTR_FORMAT " length: %u",
! name(), count, p2i(curr), p2i(prev0), p2i(prev1), length()));
if (curr->next() != NULL) {
guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up");
}
guarantee(curr->hrm_index() == 0 || curr->hrm_index() > last_index, "List should be sorted");
--- 303,314 ----
while (curr != NULL) {
verify_region(curr);
count++;
guarantee(count < _unrealistically_long_length,
! "%s", hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: " PTR_FORMAT " prev0: " PTR_FORMAT " " "prev1: " PTR_FORMAT " length: %u",
! name(), count, p2i(curr), p2i(prev0), p2i(prev1), length()).buffer());
if (curr->next() != NULL) {
guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up");
}
guarantee(curr->hrm_index() == 0 || curr->hrm_index() > last_index, "List should be sorted");
*** 319,333 ****
prev1 = prev0;
prev0 = curr;
curr = curr->next();
}
! guarantee(_tail == prev0, err_msg("Expected %s to end with %u but it ended with %u.", name(), _tail->hrm_index(), prev0->hrm_index()));
guarantee(_tail == NULL || _tail->next() == NULL, "_tail should not have a next");
! guarantee(length() == count, err_msg("%s count mismatch. Expected %u, actual %u.", name(), length(), count));
! guarantee(total_capacity_bytes() == capacity, err_msg("%s capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT,
! name(), total_capacity_bytes(), capacity));
}
// Note on the check_mt_safety() methods below:
//
// Verification of the "master" heap region sets / lists that are
--- 319,333 ----
prev1 = prev0;
prev0 = curr;
curr = curr->next();
}
! guarantee(_tail == prev0, "Expected %s to end with %u but it ended with %u.", name(), _tail->hrm_index(), prev0->hrm_index());
guarantee(_tail == NULL || _tail->next() == NULL, "_tail should not have a next");
! guarantee(length() == count, "%s count mismatch. Expected %u, actual %u.", name(), length(), count);
! guarantee(total_capacity_bytes() == capacity, "%s capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT,
! name(), total_capacity_bytes(), capacity);
}
// Note on the check_mt_safety() methods below:
//
// Verification of the "master" heap region sets / lists that are
< prev index next >