|
@@ -55,8 +55,7 @@ size_t ShenandoahHeapRegion::MaxTLABSizeWords = 0; |
|
|
|
|
|
ShenandoahHeapRegion::PaddedAllocSeqNum ShenandoahHeapRegion::_alloc_seq_num; |
|
|
|
|
|
ShenandoahHeapRegion::ShenandoahHeapRegion(ShenandoahHeap* heap, HeapWord* start, size_t index, bool committed) : |
|
|
_heap(heap), |
|
|
ShenandoahHeapRegion::ShenandoahHeapRegion(HeapWord* start, size_t index, bool committed) : |
|
|
_region_number(index), |
|
|
_bottom(start), |
|
|
_end(start + RegionSizeWords), |
|
@@ -109,7 +108,7 @@ void ShenandoahHeapRegion::make_regular_allocation() { |
|
|
|
|
|
void ShenandoahHeapRegion::make_regular_bypass() { |
|
|
shenandoah_assert_heaplocked(); |
|
|
assert (_heap->is_full_gc_in_progress() || _heap->is_degenerated_gc_in_progress(), |
|
|
assert (ShenandoahHeap::heap()->is_full_gc_in_progress() || ShenandoahHeap::heap()->is_degenerated_gc_in_progress(), |
|
|
"only for full or degen GC"); |
|
|
|
|
|
switch (_state) { |
|
@@ -147,7 +146,7 @@ void ShenandoahHeapRegion::make_humongous_start() { |
|
|
|
|
|
void ShenandoahHeapRegion::make_humongous_start_bypass() { |
|
|
shenandoah_assert_heaplocked(); |
|
|
assert (_heap->is_full_gc_in_progress(), "only for full GC"); |
|
|
assert (ShenandoahHeap::heap()->is_full_gc_in_progress(), "only for full GC"); |
|
|
|
|
|
switch (_state) { |
|
|
case _empty_committed: |
|
@@ -176,7 +175,7 @@ void ShenandoahHeapRegion::make_humongous_cont() { |
|
|
|
|
|
void ShenandoahHeapRegion::make_humongous_cont_bypass() { |
|
|
shenandoah_assert_heaplocked(); |
|
|
assert (_heap->is_full_gc_in_progress(), "only for full GC"); |
|
|
assert (ShenandoahHeap::heap()->is_full_gc_in_progress(), "only for full GC"); |
|
|
|
|
|
switch (_state) { |
|
|
case _empty_committed: |
|
@@ -268,7 +267,7 @@ void ShenandoahHeapRegion::make_trash_immediate() { |
|
|
|
|
|
// On this path, we know there are no marked objects in the region, |
|
|
// tell marking context about it to bypass bitmap resets. |
|
|
_heap->complete_marking_context()->reset_top_bitmap(this); |
|
|
ShenandoahHeap::heap()->complete_marking_context()->reset_top_bitmap(this); |
|
|
} |
|
|
|
|
|
void ShenandoahHeapRegion::make_empty() { |
|
@@ -297,7 +296,7 @@ void ShenandoahHeapRegion::make_uncommitted() { |
|
|
|
|
|
void ShenandoahHeapRegion::make_committed_bypass() { |
|
|
shenandoah_assert_heaplocked(); |
|
|
assert (_heap->is_full_gc_in_progress(), "only for full GC"); |
|
|
assert (ShenandoahHeap::heap()->is_full_gc_in_progress(), "only for full GC"); |
|
|
|
|
|
switch (_state) { |
|
|
case _empty_uncommitted: |
|
@@ -325,7 +324,7 @@ void ShenandoahHeapRegion::reset_alloc_metadata_to_shared() { |
|
|
_tlab_allocs = 0; |
|
|
_gclab_allocs = 0; |
|
|
_shared_allocs = used() >> LogHeapWordSize; |
|
|
if (_heap->is_traversal_mode()) { |
|
|
if (ShenandoahHeap::heap()->is_traversal_mode()) { |
|
|
update_seqnum_last_alloc_mutator(); |
|
|
} |
|
|
} else { |
|
@@ -334,7 +333,7 @@ void ShenandoahHeapRegion::reset_alloc_metadata_to_shared() { |
|
|
} |
|
|
|
|
|
void ShenandoahHeapRegion::update_seqnum_last_alloc_mutator() { |
|
|
assert(_heap->is_traversal_mode(), "Sanity"); |
|
|
assert(ShenandoahHeap::heap()->is_traversal_mode(), "Sanity"); |
|
|
shenandoah_assert_heaplocked_or_safepoint(); |
|
|
_seqnum_last_alloc_mutator = _alloc_seq_num.value++; |
|
|
} |
|
@@ -417,7 +416,7 @@ void ShenandoahHeapRegion::print_on(outputStream* st) const { |
|
|
st->print("|BTE " INTPTR_FORMAT_W(12) ", " INTPTR_FORMAT_W(12) ", " INTPTR_FORMAT_W(12), |
|
|
p2i(bottom()), p2i(top()), p2i(end())); |
|
|
st->print("|TAMS " INTPTR_FORMAT_W(12), |
|
|
p2i(_heap->marking_context()->top_at_mark_start(const_cast<ShenandoahHeapRegion*>(this)))); |
|
|
p2i(ShenandoahHeap::heap()->marking_context()->top_at_mark_start(const_cast<ShenandoahHeapRegion*>(this)))); |
|
|
st->print("|UWM " INTPTR_FORMAT_W(12), |
|
|
p2i(_update_watermark)); |
|
|
st->print("|U " SIZE_FORMAT_W(5) "%1s", byte_size_in_proper_unit(used()), proper_unit_for_byte_size(used())); |
|
@@ -460,13 +459,14 @@ void ShenandoahHeapRegion::oop_iterate_humongous(OopIterateClosure* blk) { |
|
|
} |
|
|
|
|
|
ShenandoahHeapRegion* ShenandoahHeapRegion::humongous_start_region() const { |
|
|
ShenandoahHeap* heap = ShenandoahHeap::heap(); |
|
|
assert(is_humongous(), "Must be a part of the humongous region"); |
|
|
size_t reg_num = region_number(); |
|
|
ShenandoahHeapRegion* r = const_cast<ShenandoahHeapRegion*>(this); |
|
|
while (!r->is_humongous_start()) { |
|
|
assert(reg_num > 0, "Sanity"); |
|
|
reg_num --; |
|
|
r = _heap->get_region(reg_num); |
|
|
r = heap->get_region(reg_num); |
|
|
assert(r->is_humongous(), "Must be a part of the humongous region"); |
|
|
} |
|
|
assert(r->is_humongous_start(), "Must be"); |
|
@@ -479,7 +479,7 @@ void ShenandoahHeapRegion::recycle() { |
|
|
|
|
|
reset_alloc_metadata(); |
|
|
|
|
|
_heap->marking_context()->reset_top_at_mark_start(this); |
|
|
ShenandoahHeap::heap()->marking_context()->reset_top_at_mark_start(this); |
|
|
set_update_watermark(bottom()); |
|
|
|
|
|
make_empty(); |
|
@@ -674,23 +674,25 @@ void ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) { |
|
|
} |
|
|
|
|
|
void ShenandoahHeapRegion::do_commit() { |
|
|
if (!_heap->is_heap_region_special() && !os::commit_memory((char *) bottom(), RegionSizeBytes, false)) { |
|
|
ShenandoahHeap* heap = ShenandoahHeap::heap(); |
|
|
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)) { |
|
|
if (!heap->commit_bitmap_slice(this)) { |
|
|
report_java_out_of_memory("Unable to commit bitmaps for region"); |
|
|
} |
|
|
_heap->increase_committed(ShenandoahHeapRegion::region_size_bytes()); |
|
|
heap->increase_committed(ShenandoahHeapRegion::region_size_bytes()); |
|
|
} |
|
|
|
|
|
void ShenandoahHeapRegion::do_uncommit() { |
|
|
if (!_heap->is_heap_region_special() && !os::uncommit_memory((char *) bottom(), RegionSizeBytes)) { |
|
|
ShenandoahHeap* heap = ShenandoahHeap::heap(); |
|
|
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)) { |
|
|
if (!heap->uncommit_bitmap_slice(this)) { |
|
|
report_java_out_of_memory("Unable to uncommit bitmaps for region"); |
|
|
} |
|
|
_heap->decrease_committed(ShenandoahHeapRegion::region_size_bytes()); |
|
|
heap->decrease_committed(ShenandoahHeapRegion::region_size_bytes()); |
|
|
} |
|
|
|
|
|
void ShenandoahHeapRegion::set_state(RegionState to) { |
|
|