Skip to content

Commit c520469

Browse files
author
Thomas Schatzl
committedOct 23, 2020
8255131: G1CollectedHeap::is_in() returns wrong result
Reviewed-by: sjohanss, kbarrett, ayang
1 parent 107fb9c commit c520469

File tree

5 files changed

+4
-29
lines changed

5 files changed

+4
-29
lines changed
 

‎src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void G1BlockOffsetTable::check_index(size_t index, const char* msg) const {
6060
assert((index) < (_reserved.word_size() >> BOTConstants::LogN_words),
6161
"%s - index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT,
6262
msg, (index), (_reserved.word_size() >> BOTConstants::LogN_words));
63-
assert(G1CollectedHeap::heap()->is_in_exact(address_for_index_raw(index)),
63+
assert(G1CollectedHeap::heap()->is_in(address_for_index_raw(index)),
6464
"Index " SIZE_FORMAT " corresponding to " PTR_FORMAT
6565
" (%u) is not in committed area.",
6666
(index),

‎src/hotspot/share/gc/g1/g1CollectedHeap.cpp

+1-21
Original file line numberDiff line numberDiff line change
@@ -2260,29 +2260,9 @@ bool G1CollectedHeap::try_collect(GCCause::Cause cause) {
22602260
}
22612261

22622262
bool G1CollectedHeap::is_in(const void* p) const {
2263-
if (_hrm->reserved().contains(p)) {
2264-
// Given that we know that p is in the reserved space,
2265-
// heap_region_containing() should successfully
2266-
// return the containing region.
2267-
HeapRegion* hr = heap_region_containing(p);
2268-
return hr->is_in(p);
2269-
} else {
2270-
return false;
2271-
}
2263+
return is_in_reserved(p) && _hrm->is_available(addr_to_region((HeapWord*)p));
22722264
}
22732265

2274-
#ifdef ASSERT
2275-
bool G1CollectedHeap::is_in_exact(const void* p) const {
2276-
bool contains = reserved().contains(p);
2277-
bool available = _hrm->is_available(addr_to_region((HeapWord*)p));
2278-
if (contains && available) {
2279-
return true;
2280-
} else {
2281-
return false;
2282-
}
2283-
}
2284-
#endif
2285-
22862266
// Iteration functions.
22872267

22882268
// Iterates an ObjectClosure over all objects within a HeapRegion.

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

-5
Original file line numberDiff line numberDiff line change
@@ -1136,11 +1136,6 @@ class G1CollectedHeap : public CollectedHeap {
11361136
void decrement_summary_bytes(size_t bytes);
11371137

11381138
virtual bool is_in(const void* p) const;
1139-
#ifdef ASSERT
1140-
// Returns whether p is in one of the available areas of the heap. Slow but
1141-
// extensive version.
1142-
bool is_in_exact(const void* p) const;
1143-
#endif
11441139

11451140
// Return "TRUE" iff the given object address is within the collection
11461141
// set. Assumes that the reference points into the heap.

‎src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void G1CMBitMap::clear_region(HeapRegion* region) {
5151

5252
#ifdef ASSERT
5353
void G1CMBitMap::check_mark(HeapWord* addr) {
54-
assert(G1CollectedHeap::heap()->is_in_exact(addr),
54+
assert(G1CollectedHeap::heap()->is_in(addr),
5555
"Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
5656
p2i(this), p2i(addr));
5757
}

‎src/hotspot/share/gc/g1/g1RemSet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ void G1RemSet::cleanup_after_scan_heap_roots() {
13041304
inline void check_card_ptr(CardTable::CardValue* card_ptr, G1CardTable* ct) {
13051305
#ifdef ASSERT
13061306
G1CollectedHeap* g1h = G1CollectedHeap::heap();
1307-
assert(g1h->is_in_exact(ct->addr_for(card_ptr)),
1307+
assert(g1h->is_in(ct->addr_for(card_ptr)),
13081308
"Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap",
13091309
p2i(card_ptr),
13101310
ct->index_for(ct->addr_for(card_ptr)),

0 commit comments

Comments
 (0)
Please sign in to comment.