Skip to content

Commit

Permalink
8335395: G1: Verification does not detect references into Free regions
Browse files Browse the repository at this point in the history
Reviewed-by: ayang, iwalulya
  • Loading branch information
Thomas Schatzl committed Jul 3, 2024
1 parent 13b782c commit 9a91865
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/gc/g1/g1HeapRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 9a91865

Please sign in to comment.