8289093: BlockLocationPrinter fails to decode addresses with G1

Reviewed-by: ayang, iwalulya
This commit is contained in:
Thomas Schatzl 2022-06-27 11:41:24 +00:00
parent 784a0f0496
commit 699ad45b43

View File

@ -2348,6 +2348,12 @@ void G1CollectedHeap::par_iterate_regions_array(HeapRegionClosure* cl,
HeapWord* G1CollectedHeap::block_start(const void* addr) const {
HeapRegion* hr = heap_region_containing(addr);
// The CollectedHeap API requires us to not fail for any given address within
// the heap. HeapRegion::block_start() has been optimized to not accept addresses
// outside of the allocated area.
if (addr >= hr->top()) {
return nullptr;
}
return hr->block_start(addr);
}