Skip to content

Commit b7747c2

Browse files
Thomas Schatzlpull[bot]
Thomas Schatzl
authored andcommitted
8335395: G1: Verification does not detect references into Free regions
Reviewed-by: ayang, iwalulya
1 parent 3db7c08 commit b7747c2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ inline bool G1CollectedHeap::is_obj_filler(const oop obj) {
253253
}
254254

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

src/hotspot/share/gc/g1/g1HeapRegion.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,10 @@ class G1VerifyLiveAndRemSetClosure : public BasicOopIterateClosure {
547547
}
548548

549549
bool failed() const {
550-
return !_is_in_heap || this->_g1h->is_obj_dead_cond(this->_obj, _vo);
550+
return !_is_in_heap ||
551+
// is_obj_dead* assume that obj is not in a Free region.
552+
this->_g1h->heap_region_containing(this->_obj)->is_free() ||
553+
this->_g1h->is_obj_dead_cond(this->_obj, _vo);
551554
}
552555

553556
void report_error() {

0 commit comments

Comments
 (0)