void HeapRegionSetBase::verify_region(HeapRegion* hr) { assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrs_index())); assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrs_index())); // currently we don't use these sets for young regions assert(hr->isHumongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrs_index(), name())); assert(hr->is_empty() == regions_empty(), err_msg("Wrong empty state for region %u and set %s", hr->hrs_index(), name())); assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrs_index())); }
void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) { out->cr(); out->print_cr("Set: %s (" PTR_FORMAT ")", name(), p2i(this)); out->print_cr(" Region Assumptions"); out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous())); out->print_cr(" free : %s", BOOL_TO_STR(regions_free())); out->print_cr(" Attributes"); out->print_cr(" length : %14u", length()); }
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()); }
void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) { out->cr(); out->print_cr("Set: %s ("PTR_FORMAT")", name(), this); out->print_cr(" Region Assumptions"); out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous())); out->print_cr(" empty : %s", BOOL_TO_STR(regions_empty())); out->print_cr(" Attributes"); out->print_cr(" length : %14u", length()); out->print_cr(" total capacity : "SIZE_FORMAT_W(14)" bytes", total_capacity_bytes()); }
bool HeapRegionSetBase::verify_region(HeapRegion* hr, HeapRegionSetBase* expected_containing_set) { const char* error_message = NULL; if (!regions_humongous()) { if (hr->isHumongous()) { error_message = "the region should not be humongous"; } } else { if (!hr->isHumongous() || !hr->startsHumongous()) { error_message = "the region should be 'starts humongous'"; } } if (!regions_empty()) { if (hr->is_empty()) { error_message = "the region should not be empty"; } } else { if (!hr->is_empty()) { error_message = "the region should be empty"; } } #ifdef ASSERT // The _containing_set field is only available when ASSERT is defined. if (hr->containing_set() != expected_containing_set) { error_message = "inconsistent containing set found"; } #endif // ASSERT const char* extra_error_message = verify_region_extra(hr); if (extra_error_message != NULL) { error_message = extra_error_message; } if (error_message != NULL) { outputStream* out = tty; out->cr(); out->print_cr("## [%s] %s", name(), error_message); out->print_cr("## Offending Region: "PTR_FORMAT, hr); out->print_cr(" "HR_FORMAT, HR_FORMAT_PARAMS(hr)); #ifdef ASSERT out->print_cr(" containing set: "PTR_FORMAT, hr->containing_set()); #endif // ASSERT out->print_cr("## Offending Region Set: "PTR_FORMAT, this); print_on(out); return false; } else { return true; } }
void HeapRegionSetBase::verify() { // It's important that we also observe the MT safety protocol even // for the verification calls. If we do verification without the // appropriate locks and the set changes underneath our feet // verification might fail and send us on a wild goose chase. hrl_assert_mt_safety_ok(this); guarantee(( is_empty() && length() == 0 && region_num() == 0 && total_used_bytes() == 0 && total_capacity_bytes() == 0) || (!is_empty() && length() >= 0 && region_num() >= 0 && total_used_bytes() >= 0 && total_capacity_bytes() >= 0), hrl_ext_msg(this, "invariant")); guarantee((!regions_humongous() && region_num() == length()) || ( regions_humongous() && region_num() >= length()), hrl_ext_msg(this, "invariant")); guarantee(!regions_empty() || total_used_bytes() == 0, hrl_ext_msg(this, "invariant")); guarantee(total_used_bytes() <= total_capacity_bytes(), hrl_ext_msg(this, "invariant")); }