8241692: Shenandoah: remove ShenandoahHeapRegion::_reserved

Reviewed-by: zgu, rkennke
This commit is contained in:
Aleksey Shipilev 2020-03-27 15:33:05 +01:00
parent a45889dc5e
commit 7056b96854
3 changed files with 9 additions and 14 deletions

View File

@ -285,12 +285,10 @@ jint ShenandoahHeap::initialize() {
{
ShenandoahHeapLocker locker(lock());
size_t size_words = ShenandoahHeapRegion::region_size_words();
for (size_t i = 0; i < _num_regions; i++) {
HeapWord* start = (HeapWord*)sh_rs.base() + size_words * i;
HeapWord* start = (HeapWord*)sh_rs.base() + ShenandoahHeapRegion::region_size_words() * i;
bool is_committed = i < num_committed_regions;
ShenandoahHeapRegion* r = new ShenandoahHeapRegion(this, start, size_words, i, is_committed);
ShenandoahHeapRegion* r = new ShenandoahHeapRegion(this, start, i, is_committed);
_marking_context->initialize_top_at_mark_start(r);
_regions[i] = r;

View File

@ -55,13 +55,11 @@ size_t ShenandoahHeapRegion::MaxTLABSizeWords = 0;
ShenandoahHeapRegion::PaddedAllocSeqNum ShenandoahHeapRegion::_alloc_seq_num;
ShenandoahHeapRegion::ShenandoahHeapRegion(ShenandoahHeap* heap, HeapWord* start,
size_t size_words, size_t index, bool committed) :
ShenandoahHeapRegion::ShenandoahHeapRegion(ShenandoahHeap* heap, HeapWord* start, size_t index, bool committed) :
_heap(heap),
_reserved(MemRegion(start, size_words)),
_region_number(index),
_bottom(start),
_end(start + size_words),
_end(start + RegionSizeWords),
_new_top(NULL),
_empty_time(os::elapsedTime()),
_state(committed ? _empty_committed : _empty_uncommitted),
@ -77,7 +75,7 @@ ShenandoahHeapRegion::ShenandoahHeapRegion(ShenandoahHeap* heap, HeapWord* start
assert(Universe::on_page_boundary(_bottom) && Universe::on_page_boundary(_end),
"invalid space boundaries");
if (ZapUnusedHeapArea && committed) {
SpaceMangler::mangle_region(_reserved);
SpaceMangler::mangle_region(MemRegion(_bottom, _end));
}
}
@ -487,7 +485,7 @@ void ShenandoahHeapRegion::recycle() {
make_empty();
if (ZapUnusedHeapArea) {
SpaceMangler::mangle_region(_reserved);
SpaceMangler::mangle_region(MemRegion(bottom(), end()));
}
}
@ -676,7 +674,7 @@ void ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
}
void ShenandoahHeapRegion::do_commit() {
if (!_heap->is_heap_region_special() && !os::commit_memory((char *) _reserved.start(), _reserved.byte_size(), false)) {
if (!_heap->is_heap_region_special() && !os::commit_memory((char *) bottom(), RegionSizeBytes, false)) {
report_java_out_of_memory("Unable to commit region");
}
if (!_heap->commit_bitmap_slice(this)) {
@ -686,7 +684,7 @@ void ShenandoahHeapRegion::do_commit() {
}
void ShenandoahHeapRegion::do_uncommit() {
if (!_heap->is_heap_region_special() && !os::uncommit_memory((char *) _reserved.start(), _reserved.byte_size())) {
if (!_heap->is_heap_region_special() && !os::uncommit_memory((char *) bottom(), RegionSizeBytes)) {
report_java_out_of_memory("Unable to uncommit region");
}
if (!_heap->uncommit_bitmap_slice(this)) {

View File

@ -239,7 +239,6 @@ private:
// Never updated fields
ShenandoahHeap* const _heap;
MemRegion const _reserved;
size_t const _region_number;
HeapWord* const _bottom;
HeapWord* const _end;
@ -269,7 +268,7 @@ private:
shenandoah_padding(0);
public:
ShenandoahHeapRegion(ShenandoahHeap* heap, HeapWord* start, size_t size_words, size_t index, bool committed);
ShenandoahHeapRegion(ShenandoahHeap* heap, HeapWord* start, size_t index, bool committed);
static const size_t MIN_NUM_REGIONS = 10;