8335395: G1: Verification does not detect references into Free regions

Reviewed-by: ayang, iwalulya
This commit is contained in:
Thomas Schatzl 2024-07-03 16:29:52 +00:00
parent 13b782c3de
commit 9a91865ff3
2 changed files with 5 additions and 1 deletions

@ -253,6 +253,7 @@ inline bool G1CollectedHeap::is_obj_filler(const oop obj) {
}
inline bool G1CollectedHeap::is_obj_dead(const oop obj, const G1HeapRegion* hr) const {
assert(!hr->is_free(), "looking up obj " PTR_FORMAT " in Free region %u", p2i(obj), hr->hrm_index());
if (hr->is_in_parsable_area(obj)) {
// This object is in the parsable part of the heap, live unless scrubbed.
return is_obj_filler(obj);

@ -547,7 +547,10 @@ class G1VerifyLiveAndRemSetClosure : public BasicOopIterateClosure {
}
bool failed() const {
return !_is_in_heap || this->_g1h->is_obj_dead_cond(this->_obj, _vo);
return !_is_in_heap ||
// is_obj_dead* assume that obj is not in a Free region.
this->_g1h->heap_region_containing(this->_obj)->is_free() ||
this->_g1h->is_obj_dead_cond(this->_obj, _vo);
}
void report_error() {