提交 ae5a0291 编写于 作者: T tschatzl

8068036: assert(is_available(index)) failed in G1 cset

Summary: Some verification code iterated over the heap using the region mapping array. This is not allowed. Changed to use the regular iteration method with closure.
Reviewed-by: jwilhelm, brutisso
上级 b6b17b79
...@@ -6017,56 +6017,68 @@ void G1CollectedHeap::check_bitmaps(const char* caller) { ...@@ -6017,56 +6017,68 @@ void G1CollectedHeap::check_bitmaps(const char* caller) {
guarantee(!cl.failures(), "bitmap verification"); guarantee(!cl.failures(), "bitmap verification");
} }
bool G1CollectedHeap::check_cset_fast_test() { class G1CheckCSetFastTableClosure : public HeapRegionClosure {
bool failures = false; private:
for (uint i = 0; i < _hrm.length(); i += 1) { bool _failures;
HeapRegion* hr = _hrm.at(i); public:
InCSetState cset_state = (InCSetState) _in_cset_fast_test.get_by_index((uint) i); G1CheckCSetFastTableClosure() : HeapRegionClosure(), _failures(false) { }
virtual bool doHeapRegion(HeapRegion* hr) {
uint i = hr->hrm_index();
InCSetState cset_state = (InCSetState) G1CollectedHeap::heap()->_in_cset_fast_test.get_by_index(i);
if (hr->isHumongous()) { if (hr->isHumongous()) {
if (hr->in_collection_set()) { if (hr->in_collection_set()) {
gclog_or_tty->print_cr("\n## humongous region %u in CSet", i); gclog_or_tty->print_cr("\n## humongous region %u in CSet", i);
failures = true; _failures = true;
break; return true;
} }
if (cset_state.is_in_cset()) { if (cset_state.is_in_cset()) {
gclog_or_tty->print_cr("\n## inconsistent cset state %d for humongous region %u", cset_state.value(), i); gclog_or_tty->print_cr("\n## inconsistent cset state %d for humongous region %u", cset_state.value(), i);
failures = true; _failures = true;
break; return true;
} }
if (hr->continuesHumongous() && cset_state.is_humongous()) { if (hr->continuesHumongous() && cset_state.is_humongous()) {
gclog_or_tty->print_cr("\n## inconsistent cset state %d for continues humongous region %u", cset_state.value(), i); gclog_or_tty->print_cr("\n## inconsistent cset state %d for continues humongous region %u", cset_state.value(), i);
failures = true; _failures = true;
break; return true;
} }
} else { } else {
if (cset_state.is_humongous()) { if (cset_state.is_humongous()) {
gclog_or_tty->print_cr("\n## inconsistent cset state %d for non-humongous region %u", cset_state.value(), i); gclog_or_tty->print_cr("\n## inconsistent cset state %d for non-humongous region %u", cset_state.value(), i);
failures = true; _failures = true;
break; return true;
} }
if (hr->in_collection_set() != cset_state.is_in_cset()) { if (hr->in_collection_set() != cset_state.is_in_cset()) {
gclog_or_tty->print_cr("\n## in CSet %d / cset state %d inconsistency for region %u", gclog_or_tty->print_cr("\n## in CSet %d / cset state %d inconsistency for region %u",
hr->in_collection_set(), cset_state.value(), i); hr->in_collection_set(), cset_state.value(), i);
failures = true; _failures = true;
break; return true;
} }
if (cset_state.is_in_cset()) { if (cset_state.is_in_cset()) {
if (hr->is_young() != (cset_state.is_young())) { if (hr->is_young() != (cset_state.is_young())) {
gclog_or_tty->print_cr("\n## is_young %d / cset state %d inconsistency for region %u", gclog_or_tty->print_cr("\n## is_young %d / cset state %d inconsistency for region %u",
hr->is_young(), cset_state.value(), i); hr->is_young(), cset_state.value(), i);
failures = true; _failures = true;
break; return true;
} }
if (hr->is_old() != (cset_state.is_old())) { if (hr->is_old() != (cset_state.is_old())) {
gclog_or_tty->print_cr("\n## is_old %d / cset state %d inconsistency for region %u", gclog_or_tty->print_cr("\n## is_old %d / cset state %d inconsistency for region %u",
hr->is_old(), cset_state.value(), i); hr->is_old(), cset_state.value(), i);
failures = true; _failures = true;
break; return true;
} }
} }
} }
return false;
} }
return !failures;
bool failures() const { return _failures; }
};
bool G1CollectedHeap::check_cset_fast_test() {
G1CheckCSetFastTableClosure cl;
_hrm.iterate(&cl);
return !cl.failures();
} }
#endif // PRODUCT #endif // PRODUCT
......
...@@ -213,6 +213,9 @@ class G1CollectedHeap : public SharedHeap { ...@@ -213,6 +213,9 @@ class G1CollectedHeap : public SharedHeap {
// Other related classes. // Other related classes.
friend class G1MarkSweep; friend class G1MarkSweep;
// Testing classes.
friend class G1CheckCSetFastTableClosure;
private: private:
// The one and only G1CollectedHeap, so static functions can find it. // The one and only G1CollectedHeap, so static functions can find it.
static G1CollectedHeap* _g1h; static G1CollectedHeap* _g1h;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册