8241844: Shenandoah: rename ShenandoahHeapRegion::region_number
Reviewed-by: rkennke
This commit is contained in:
parent
87396af743
commit
6df2370120
@ -257,7 +257,7 @@ void ShenandoahAsserts::assert_in_correct_region(void* interior_loc, oop obj, co
|
||||
|
||||
size_t alloc_size = obj->size();
|
||||
if (alloc_size > ShenandoahHeapRegion::humongous_threshold_words()) {
|
||||
size_t idx = r->region_number();
|
||||
size_t idx = r->index();
|
||||
size_t num_regions = ShenandoahHeapRegion::required_regions(alloc_size * HeapWordSize);
|
||||
for (size_t i = idx; i < idx + num_regions; i++) {
|
||||
ShenandoahHeapRegion* chain_reg = heap->get_region(i);
|
||||
|
@ -83,7 +83,7 @@ void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
|
||||
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
|
||||
assert(Thread::current()->is_VM_thread(), "Must be VMThread");
|
||||
assert(!is_in(r), "Already in collection set");
|
||||
_cset_map[r->region_number()] = 1;
|
||||
_cset_map[r->index()] = 1;
|
||||
_region_count ++;
|
||||
_garbage += r->garbage();
|
||||
_live_data += r->get_live_data_bytes();
|
||||
@ -103,7 +103,7 @@ void ShenandoahCollectionSet::remove_region(ShenandoahHeapRegion* r) {
|
||||
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
|
||||
assert(Thread::current()->is_VM_thread(), "Must be VMThread");
|
||||
assert(is_in(r), "Not in collection set");
|
||||
_cset_map[r->region_number()] = 0;
|
||||
_cset_map[r->index()] = 0;
|
||||
_region_count --;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
}
|
||||
|
||||
inline bool is_in(ShenandoahHeapRegion* r) const;
|
||||
inline bool is_in(size_t region_number) const;
|
||||
inline bool is_in(size_t region_idx) const;
|
||||
inline bool is_in(oop obj) const;
|
||||
inline bool is_in_loc(void* loc) const;
|
||||
|
||||
|
@ -30,13 +30,13 @@
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
|
||||
|
||||
bool ShenandoahCollectionSet::is_in(size_t region_number) const {
|
||||
assert(region_number < _heap->num_regions(), "Sanity");
|
||||
return _cset_map[region_number] == 1;
|
||||
bool ShenandoahCollectionSet::is_in(size_t region_idx) const {
|
||||
assert(region_idx < _heap->num_regions(), "Sanity");
|
||||
return _cset_map[region_idx] == 1;
|
||||
}
|
||||
|
||||
bool ShenandoahCollectionSet::is_in(ShenandoahHeapRegion* r) const {
|
||||
return is_in(r->region_number());
|
||||
return is_in(r->index());
|
||||
}
|
||||
|
||||
bool ShenandoahCollectionSet::is_in(oop p) const {
|
||||
|
@ -148,7 +148,7 @@ HeapWord* ShenandoahFreeSet::allocate_single(ShenandoahAllocRequest& req, bool&
|
||||
}
|
||||
|
||||
HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, ShenandoahAllocRequest& req, bool& in_new_region) {
|
||||
assert (!has_no_alloc_capacity(r), "Performance: should avoid full regions on this path: " SIZE_FORMAT, r->region_number());
|
||||
assert (!has_no_alloc_capacity(r), "Performance: should avoid full regions on this path: " SIZE_FORMAT, r->index());
|
||||
|
||||
if (_heap->is_concurrent_root_in_progress() &&
|
||||
r->is_trash()) {
|
||||
@ -217,7 +217,7 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah
|
||||
}
|
||||
}
|
||||
|
||||
size_t num = r->region_number();
|
||||
size_t num = r->index();
|
||||
_collector_free_bitmap.clear_bit(num);
|
||||
_mutator_free_bitmap.clear_bit(num);
|
||||
// Touched the bounds? Need to update:
|
||||
@ -307,7 +307,7 @@ HeapWord* ShenandoahFreeSet::allocate_contiguous(ShenandoahAllocRequest& req) {
|
||||
ShenandoahHeapRegion* r = _heap->get_region(i);
|
||||
try_recycle_trashed(r);
|
||||
|
||||
assert(i == beg || _heap->get_region(i-1)->region_number() + 1 == r->region_number(), "Should be contiguous");
|
||||
assert(i == beg || _heap->get_region(i - 1)->index() + 1 == r->index(), "Should be contiguous");
|
||||
assert(r->is_empty(), "Should be empty");
|
||||
|
||||
if (i == beg) {
|
||||
@ -327,7 +327,7 @@ HeapWord* ShenandoahFreeSet::allocate_contiguous(ShenandoahAllocRequest& req) {
|
||||
r->set_top(r->bottom() + used_words);
|
||||
r->reset_alloc_metadata_to_shared();
|
||||
|
||||
_mutator_free_bitmap.clear_bit(r->region_number());
|
||||
_mutator_free_bitmap.clear_bit(r->index());
|
||||
}
|
||||
|
||||
// While individual regions report their true use, all humongous regions are
|
||||
@ -388,7 +388,7 @@ void ShenandoahFreeSet::recycle_trash() {
|
||||
}
|
||||
|
||||
void ShenandoahFreeSet::flip_to_gc(ShenandoahHeapRegion* r) {
|
||||
size_t idx = r->region_number();
|
||||
size_t idx = r->index();
|
||||
|
||||
assert(_mutator_free_bitmap.at(idx), "Should be in mutator view");
|
||||
assert(can_allocate_from(r), "Should not be allocated");
|
||||
|
@ -132,8 +132,8 @@ public:
|
||||
virtual void work(uint worker_id) {
|
||||
ShenandoahHeapRegion* r = _regions.next();
|
||||
while (r != NULL) {
|
||||
size_t start = r->region_number() * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor();
|
||||
size_t end = (r->region_number() + 1) * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor();
|
||||
size_t start = r->index() * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor();
|
||||
size_t end = (r->index() + 1) * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor();
|
||||
assert (end <= _bitmap_size, "end is sane: " SIZE_FORMAT " < " SIZE_FORMAT, end, _bitmap_size);
|
||||
|
||||
os::pretouch_memory(_bitmap_base + start, _bitmap_base + end, _page_size);
|
||||
@ -952,7 +952,7 @@ private:
|
||||
ShenandoahConcurrentEvacuateRegionObjectClosure cl(_sh);
|
||||
ShenandoahHeapRegion* r;
|
||||
while ((r =_cs->claim_next()) != NULL) {
|
||||
assert(r->has_live(), "Region " SIZE_FORMAT " should have been reclaimed early", r->region_number());
|
||||
assert(r->has_live(), "Region " SIZE_FORMAT " should have been reclaimed early", r->index());
|
||||
_sh->marked_object_iterate(r, &cl);
|
||||
|
||||
if (ShenandoahPacing) {
|
||||
@ -996,7 +996,7 @@ void ShenandoahHeap::trash_humongous_region_at(ShenandoahHeapRegion* start) {
|
||||
oop humongous_obj = oop(start->bottom());
|
||||
size_t size = humongous_obj->size();
|
||||
size_t required_regions = ShenandoahHeapRegion::required_regions(size * HeapWordSize);
|
||||
size_t index = start->region_number() + required_regions - 1;
|
||||
size_t index = start->index() + required_regions - 1;
|
||||
|
||||
assert(!start->has_live(), "liveness must be zero");
|
||||
|
||||
@ -1360,9 +1360,9 @@ public:
|
||||
r->clear_live_data();
|
||||
_ctx->capture_top_at_mark_start(r);
|
||||
} else {
|
||||
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->region_number());
|
||||
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->index());
|
||||
assert(_ctx->top_at_mark_start(r) == r->top(),
|
||||
"Region " SIZE_FORMAT " should already have correct TAMS", r->region_number());
|
||||
"Region " SIZE_FORMAT " should already have correct TAMS", r->index());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1438,9 +1438,9 @@ public:
|
||||
r->increase_live_data_alloc_words(pointer_delta(top, tams));
|
||||
}
|
||||
} else {
|
||||
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->region_number());
|
||||
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->index());
|
||||
assert(_ctx->top_at_mark_start(r) == r->top(),
|
||||
"Region " SIZE_FORMAT " should have correct TAMS", r->region_number());
|
||||
"Region " SIZE_FORMAT " should have correct TAMS", r->index());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2512,13 +2512,13 @@ void ShenandoahHeap::print_extended_on(outputStream *st) const {
|
||||
}
|
||||
|
||||
bool ShenandoahHeap::is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self) {
|
||||
size_t slice = r->region_number() / _bitmap_regions_per_slice;
|
||||
size_t slice = r->index() / _bitmap_regions_per_slice;
|
||||
|
||||
size_t regions_from = _bitmap_regions_per_slice * slice;
|
||||
size_t regions_to = MIN2(num_regions(), _bitmap_regions_per_slice * (slice + 1));
|
||||
for (size_t g = regions_from; g < regions_to; g++) {
|
||||
assert (g / _bitmap_regions_per_slice == slice, "same slice");
|
||||
if (skip_self && g == r->region_number()) continue;
|
||||
if (skip_self && g == r->index()) continue;
|
||||
if (get_region(g)->is_committed()) {
|
||||
return true;
|
||||
}
|
||||
@ -2541,7 +2541,7 @@ bool ShenandoahHeap::commit_bitmap_slice(ShenandoahHeapRegion* r) {
|
||||
}
|
||||
|
||||
// Commit the bitmap slice:
|
||||
size_t slice = r->region_number() / _bitmap_regions_per_slice;
|
||||
size_t slice = r->index() / _bitmap_regions_per_slice;
|
||||
size_t off = _bitmap_bytes_per_slice * slice;
|
||||
size_t len = _bitmap_bytes_per_slice;
|
||||
if (!os::commit_memory((char*)_bitmap_region.start() + off, len, false)) {
|
||||
@ -2565,7 +2565,7 @@ bool ShenandoahHeap::uncommit_bitmap_slice(ShenandoahHeapRegion *r) {
|
||||
}
|
||||
|
||||
// Uncommit the bitmap slice:
|
||||
size_t slice = r->region_number() / _bitmap_regions_per_slice;
|
||||
size_t slice = r->index() / _bitmap_regions_per_slice;
|
||||
size_t off = _bitmap_bytes_per_slice * slice;
|
||||
size_t len = _bitmap_bytes_per_slice;
|
||||
if (!os::uncommit_memory((char*)_bitmap_region.start() + off, len)) {
|
||||
|
@ -56,7 +56,7 @@ size_t ShenandoahHeapRegion::MaxTLABSizeWords = 0;
|
||||
ShenandoahHeapRegion::PaddedAllocSeqNum ShenandoahHeapRegion::_alloc_seq_num;
|
||||
|
||||
ShenandoahHeapRegion::ShenandoahHeapRegion(HeapWord* start, size_t index, bool committed) :
|
||||
_region_number(index),
|
||||
_index(index),
|
||||
_bottom(start),
|
||||
_end(start + RegionSizeWords),
|
||||
_new_top(NULL),
|
||||
@ -370,7 +370,7 @@ size_t ShenandoahHeapRegion::garbage() const {
|
||||
|
||||
void ShenandoahHeapRegion::print_on(outputStream* st) const {
|
||||
st->print("|");
|
||||
st->print(SIZE_FORMAT_W(5), this->_region_number);
|
||||
st->print(SIZE_FORMAT_W(5), this->_index);
|
||||
|
||||
switch (_state) {
|
||||
case _empty_uncommitted:
|
||||
@ -454,12 +454,12 @@ 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();
|
||||
size_t i = index();
|
||||
ShenandoahHeapRegion* r = const_cast<ShenandoahHeapRegion*>(this);
|
||||
while (!r->is_humongous_start()) {
|
||||
assert(reg_num > 0, "Sanity");
|
||||
reg_num --;
|
||||
r = heap->get_region(reg_num);
|
||||
assert(i > 0, "Sanity");
|
||||
i--;
|
||||
r = heap->get_region(i);
|
||||
assert(r->is_humongous(), "Must be a part of the humongous region");
|
||||
}
|
||||
assert(r->is_humongous_start(), "Must be");
|
||||
@ -691,7 +691,7 @@ void ShenandoahHeapRegion::do_uncommit() {
|
||||
void ShenandoahHeapRegion::set_state(RegionState to) {
|
||||
EventShenandoahHeapRegionStateChange evt;
|
||||
if (evt.should_commit()){
|
||||
evt.set_index((unsigned)region_number());
|
||||
evt.set_index((unsigned) index());
|
||||
evt.set_start((uintptr_t)bottom());
|
||||
evt.set_used(used());
|
||||
evt.set_from(_state);
|
||||
@ -706,7 +706,7 @@ void ShenandoahHeapRegion::record_pin() {
|
||||
}
|
||||
|
||||
void ShenandoahHeapRegion::record_unpin() {
|
||||
assert(pin_count() > 0, "Region " SIZE_FORMAT " should have non-zero pins", region_number());
|
||||
assert(pin_count() > 0, "Region " SIZE_FORMAT " should have non-zero pins", index());
|
||||
Atomic::sub(&_critical_pins, (size_t)1);
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ private:
|
||||
static PaddedAllocSeqNum _alloc_seq_num;
|
||||
|
||||
// Never updated fields
|
||||
size_t const _region_number;
|
||||
size_t const _index;
|
||||
HeapWord* const _bottom;
|
||||
HeapWord* const _end;
|
||||
|
||||
@ -353,8 +353,8 @@ public:
|
||||
return _alloc_seq_num.value - 1;
|
||||
}
|
||||
|
||||
inline size_t region_number() const {
|
||||
return _region_number;
|
||||
inline size_t index() const {
|
||||
return _index;
|
||||
}
|
||||
|
||||
// Allocation (return NULL if full)
|
||||
|
@ -59,7 +59,7 @@ ShenandoahHeapRegionSet::~ShenandoahHeapRegionSet() {
|
||||
|
||||
void ShenandoahHeapRegionSet::add_region(ShenandoahHeapRegion* r) {
|
||||
assert(!is_in(r), "Already in collection set");
|
||||
_set_map[r->region_number()] = 1;
|
||||
_set_map[r->index()] = 1;
|
||||
_region_count++;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ void ShenandoahHeapRegionSet::remove_region(ShenandoahHeapRegion* r) {
|
||||
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
|
||||
assert(Thread::current()->is_VM_thread(), "Must be VMThread");
|
||||
assert(is_in(r), "Not in region set");
|
||||
_set_map[r->region_number()] = 0;
|
||||
_set_map[r->index()] = 0;
|
||||
_region_count --;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
bool is_empty() const { return _region_count == 0; }
|
||||
|
||||
inline bool is_in(ShenandoahHeapRegion* r) const;
|
||||
inline bool is_in(size_t region_number) const;
|
||||
inline bool is_in(size_t region_idx) const;
|
||||
inline bool is_in(oop p) const;
|
||||
|
||||
void print_on(outputStream* out) const;
|
||||
|
@ -31,13 +31,13 @@
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
|
||||
|
||||
bool ShenandoahHeapRegionSet::is_in(size_t region_number) const {
|
||||
assert(region_number < _heap->num_regions(), "Sanity");
|
||||
return _set_map[region_number] == 1;
|
||||
bool ShenandoahHeapRegionSet::is_in(size_t region_idx) const {
|
||||
assert(region_idx < _heap->num_regions(), "Sanity");
|
||||
return _set_map[region_idx] == 1;
|
||||
}
|
||||
|
||||
bool ShenandoahHeapRegionSet::is_in(ShenandoahHeapRegion* r) const {
|
||||
return is_in(r->region_number());
|
||||
return is_in(r->index());
|
||||
}
|
||||
|
||||
bool ShenandoahHeapRegionSet::is_in(oop p) const {
|
||||
|
@ -57,7 +57,7 @@ class ShenandoahDumpHeapRegionInfoClosure : public ShenandoahHeapRegionClosure {
|
||||
public:
|
||||
virtual void heap_region_do(ShenandoahHeapRegion* r) {
|
||||
EventShenandoahHeapRegionInformation evt;
|
||||
evt.set_index((unsigned)r->region_number());
|
||||
evt.set_index((unsigned) r->index());
|
||||
evt.set_state((u8)r->state());
|
||||
evt.set_start((uintptr_t)r->bottom());
|
||||
evt.set_used(r->used());
|
||||
|
@ -414,7 +414,7 @@ void ShenandoahMarkCompact::calculate_target_humongous_objects() {
|
||||
ShenandoahHeapRegion *r = heap->get_region(c - 1);
|
||||
if (r->is_humongous_continuation() || (r->new_top() == r->bottom())) {
|
||||
// To-region candidate: record this, and continue scan
|
||||
to_begin = r->region_number();
|
||||
to_begin = r->index();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ void ShenandoahMarkCompact::calculate_target_humongous_objects() {
|
||||
|
||||
size_t start = to_end - num_regions;
|
||||
|
||||
if (start >= to_begin && start != r->region_number()) {
|
||||
if (start >= to_begin && start != r->index()) {
|
||||
// Fits into current window, and the move is non-trivial. Record the move then, and continue scan.
|
||||
_preserved_marks->get(0)->push_if_necessary(old_obj, old_obj->mark_raw());
|
||||
old_obj->forward_to(oop(heap->get_region(start)->bottom()));
|
||||
@ -436,8 +436,8 @@ void ShenandoahMarkCompact::calculate_target_humongous_objects() {
|
||||
}
|
||||
|
||||
// Failed to fit. Scan starting from current region.
|
||||
to_begin = r->region_number();
|
||||
to_end = r->region_number();
|
||||
to_begin = r->index();
|
||||
to_end = r->index();
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ public:
|
||||
if (r->is_empty_uncommitted()) {
|
||||
r->make_committed_bypass();
|
||||
}
|
||||
assert (r->is_committed(), "only committed regions in heap now, see region " SIZE_FORMAT, r->region_number());
|
||||
assert (r->is_committed(), "only committed regions in heap now, see region " SIZE_FORMAT, r->index());
|
||||
|
||||
// Record current region occupancy: this communicates empty regions are free
|
||||
// to the rest of Full GC code.
|
||||
@ -480,16 +480,16 @@ public:
|
||||
oop humongous_obj = oop(r->bottom());
|
||||
if (!_ctx->is_marked(humongous_obj)) {
|
||||
assert(!r->has_live(),
|
||||
"Region " SIZE_FORMAT " is not marked, should not have live", r->region_number());
|
||||
"Region " SIZE_FORMAT " is not marked, should not have live", r->index());
|
||||
_heap->trash_humongous_region_at(r);
|
||||
} else {
|
||||
assert(r->has_live(),
|
||||
"Region " SIZE_FORMAT " should have live", r->region_number());
|
||||
"Region " SIZE_FORMAT " should have live", r->index());
|
||||
}
|
||||
} else if (r->is_humongous_continuation()) {
|
||||
// If we hit continuation, the non-live humongous starts should have been trashed already
|
||||
assert(r->humongous_start_region()->has_live(),
|
||||
"Region " SIZE_FORMAT " should have live", r->region_number());
|
||||
"Region " SIZE_FORMAT " should have live", r->index());
|
||||
} else if (r->is_regular()) {
|
||||
if (!r->has_live()) {
|
||||
r->make_trash_immediate();
|
||||
@ -624,10 +624,10 @@ void ShenandoahMarkCompact::distribute_slices(ShenandoahHeapRegionSet** worker_s
|
||||
ShenandoahHeapRegionSetIterator it(worker_slices[wid]);
|
||||
ShenandoahHeapRegion* r = it.next();
|
||||
while (r != NULL) {
|
||||
size_t num = r->region_number();
|
||||
assert(ShenandoahPrepareForCompactionTask::is_candidate_region(r), "Sanity: " SIZE_FORMAT, num);
|
||||
assert(!map.at(num), "No region distributed twice: " SIZE_FORMAT, num);
|
||||
map.at_put(num, true);
|
||||
size_t idx = r->index();
|
||||
assert(ShenandoahPrepareForCompactionTask::is_candidate_region(r), "Sanity: " SIZE_FORMAT, idx);
|
||||
assert(!map.at(idx), "No region distributed twice: " SIZE_FORMAT, idx);
|
||||
map.at_put(idx, true);
|
||||
r = it.next();
|
||||
}
|
||||
}
|
||||
@ -904,12 +904,12 @@ void ShenandoahMarkCompact::compact_humongous_objects() {
|
||||
size_t words_size = old_obj->size();
|
||||
size_t num_regions = ShenandoahHeapRegion::required_regions(words_size * HeapWordSize);
|
||||
|
||||
size_t old_start = r->region_number();
|
||||
size_t old_start = r->index();
|
||||
size_t old_end = old_start + num_regions - 1;
|
||||
size_t new_start = heap->heap_region_index_containing(old_obj->forwardee());
|
||||
size_t new_end = new_start + num_regions - 1;
|
||||
assert(old_start != new_start, "must be real move");
|
||||
assert(r->is_stw_move_allowed(), "Region " SIZE_FORMAT " should be movable", r->region_number());
|
||||
assert(r->is_stw_move_allowed(), "Region " SIZE_FORMAT " should be movable", r->index());
|
||||
|
||||
Copy::aligned_conjoint_words(heap->get_region(old_start)->bottom(),
|
||||
heap->get_region(new_start)->bottom(),
|
||||
|
@ -53,7 +53,7 @@ bool ShenandoahMarkingContext::is_bitmap_clear_range(HeapWord* start, HeapWord*
|
||||
}
|
||||
|
||||
void ShenandoahMarkingContext::initialize_top_at_mark_start(ShenandoahHeapRegion* r) {
|
||||
size_t idx = r->region_number();
|
||||
size_t idx = r->index();
|
||||
HeapWord *bottom = r->bottom();
|
||||
_top_at_mark_starts_base[idx] = bottom;
|
||||
_top_bitmaps[idx] = bottom;
|
||||
@ -61,13 +61,13 @@ void ShenandoahMarkingContext::initialize_top_at_mark_start(ShenandoahHeapRegion
|
||||
|
||||
void ShenandoahMarkingContext::clear_bitmap(ShenandoahHeapRegion* r) {
|
||||
HeapWord* bottom = r->bottom();
|
||||
HeapWord* top_bitmap = _top_bitmaps[r->region_number()];
|
||||
HeapWord* top_bitmap = _top_bitmaps[r->index()];
|
||||
if (top_bitmap > bottom) {
|
||||
_mark_bit_map.clear_range_large(MemRegion(bottom, top_bitmap));
|
||||
_top_bitmaps[r->region_number()] = bottom;
|
||||
_top_bitmaps[r->index()] = bottom;
|
||||
}
|
||||
assert(is_bitmap_clear_range(bottom, r->end()),
|
||||
"Region " SIZE_FORMAT " should have no marks in bitmap", r->region_number());
|
||||
"Region " SIZE_FORMAT " should have no marks in bitmap", r->index());
|
||||
}
|
||||
|
||||
bool ShenandoahMarkingContext::is_complete() {
|
||||
|
@ -53,33 +53,33 @@ inline bool ShenandoahMarkingContext::allocated_after_mark_start(HeapWord* addr)
|
||||
}
|
||||
|
||||
inline void ShenandoahMarkingContext::capture_top_at_mark_start(ShenandoahHeapRegion *r) {
|
||||
size_t region_number = r->region_number();
|
||||
HeapWord* old_tams = _top_at_mark_starts_base[region_number];
|
||||
size_t idx = r->index();
|
||||
HeapWord* old_tams = _top_at_mark_starts_base[idx];
|
||||
HeapWord* new_tams = r->top();
|
||||
|
||||
assert(new_tams >= old_tams,
|
||||
"Region " SIZE_FORMAT", TAMS updates should be monotonic: " PTR_FORMAT " -> " PTR_FORMAT,
|
||||
region_number, p2i(old_tams), p2i(new_tams));
|
||||
idx, p2i(old_tams), p2i(new_tams));
|
||||
assert(is_bitmap_clear_range(old_tams, new_tams),
|
||||
"Region " SIZE_FORMAT ", bitmap should be clear while adjusting TAMS: " PTR_FORMAT " -> " PTR_FORMAT,
|
||||
region_number, p2i(old_tams), p2i(new_tams));
|
||||
idx, p2i(old_tams), p2i(new_tams));
|
||||
|
||||
_top_at_mark_starts_base[region_number] = new_tams;
|
||||
_top_bitmaps[region_number] = new_tams;
|
||||
_top_at_mark_starts_base[idx] = new_tams;
|
||||
_top_bitmaps[idx] = new_tams;
|
||||
}
|
||||
|
||||
inline void ShenandoahMarkingContext::reset_top_at_mark_start(ShenandoahHeapRegion* r) {
|
||||
_top_at_mark_starts_base[r->region_number()] = r->bottom();
|
||||
_top_at_mark_starts_base[r->index()] = r->bottom();
|
||||
}
|
||||
|
||||
inline HeapWord* ShenandoahMarkingContext::top_at_mark_start(ShenandoahHeapRegion* r) const {
|
||||
return _top_at_mark_starts_base[r->region_number()];
|
||||
return _top_at_mark_starts_base[r->index()];
|
||||
}
|
||||
|
||||
inline void ShenandoahMarkingContext::reset_top_bitmap(ShenandoahHeapRegion* r) {
|
||||
assert(is_bitmap_clear_range(r->bottom(), r->end()),
|
||||
"Region " SIZE_FORMAT " should have no marks in bitmap", r->region_number());
|
||||
_top_bitmaps[r->region_number()] = r->bottom();
|
||||
"Region " SIZE_FORMAT " should have no marks in bitmap", r->index());
|
||||
_top_bitmaps[r->index()] = r->bottom();
|
||||
}
|
||||
|
||||
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHMARKINGCONTEXT_INLINE_HPP
|
||||
|
@ -124,7 +124,7 @@ private:
|
||||
check(ShenandoahAsserts::_safe_unknown, obj, (obj_addr + obj->size()) <= obj_reg->top(),
|
||||
"Object end should be within the region");
|
||||
} else {
|
||||
size_t humongous_start = obj_reg->region_number();
|
||||
size_t humongous_start = obj_reg->index();
|
||||
size_t humongous_end = humongous_start + (obj->size() >> ShenandoahHeapRegion::region_size_words_shift());
|
||||
for (size_t idx = humongous_start + 1; idx < humongous_end; idx++) {
|
||||
check(ShenandoahAsserts::_safe_unknown, obj, _heap->get_region(idx)->is_humongous_continuation(),
|
||||
@ -142,7 +142,7 @@ private:
|
||||
// skip
|
||||
break;
|
||||
case ShenandoahVerifier::_verify_liveness_complete:
|
||||
Atomic::add(&_ld[obj_reg->region_number()], (uint) obj->size());
|
||||
Atomic::add(&_ld[obj_reg->index()], (uint) obj->size());
|
||||
// fallthrough for fast failure for un-live regions:
|
||||
case ShenandoahVerifier::_verify_liveness_conservative:
|
||||
check(ShenandoahAsserts::_safe_oop, obj, obj_reg->has_live(),
|
||||
@ -751,12 +751,12 @@ void ShenandoahVerifier::verify_at_safepoint(const char *label,
|
||||
if (r->is_humongous()) {
|
||||
// For humongous objects, test if start region is marked live, and if so,
|
||||
// all humongous regions in that chain have live data equal to their "used".
|
||||
juint start_live = Atomic::load_acquire(&ld[r->humongous_start_region()->region_number()]);
|
||||
juint start_live = Atomic::load_acquire(&ld[r->humongous_start_region()->index()]);
|
||||
if (start_live > 0) {
|
||||
verf_live = (juint)(r->used() / HeapWordSize);
|
||||
}
|
||||
} else {
|
||||
verf_live = Atomic::load_acquire(&ld[r->region_number()]);
|
||||
verf_live = Atomic::load_acquire(&ld[r->index()]);
|
||||
}
|
||||
|
||||
size_t reg_live = r->get_live_data_words();
|
||||
|
@ -37,7 +37,7 @@
|
||||
static_field(ShenandoahHeapRegion, RegionSizeBytes, size_t) \
|
||||
static_field(ShenandoahHeapRegion, RegionSizeBytesShift, size_t) \
|
||||
nonstatic_field(ShenandoahHeapRegion, _state, ShenandoahHeapRegion::RegionState) \
|
||||
nonstatic_field(ShenandoahHeapRegion, _region_number, size_t const) \
|
||||
nonstatic_field(ShenandoahHeapRegion, _index, size_t const) \
|
||||
nonstatic_field(ShenandoahHeapRegion, _bottom, HeapWord* const) \
|
||||
nonstatic_field(ShenandoahHeapRegion, _top, HeapWord*) \
|
||||
nonstatic_field(ShenandoahHeapRegion, _end, HeapWord* const) \
|
||||
|
@ -66,7 +66,7 @@ public class ShenandoahBitMap implements BitMapInterface {
|
||||
|
||||
private int toBitMapOffset(long offset, ShenandoahHeapRegion region) {
|
||||
long regionSize = ShenandoahHeapRegion.regionSizeBytes();
|
||||
long regionOffset = region.regionNumber() * regionSize;
|
||||
long regionOffset = region.index() * regionSize;
|
||||
long offsetInRegion = offset - regionOffset;
|
||||
|
||||
if (offsetInRegion < 0 || offsetInRegion >= regionSize) {
|
||||
|
@ -57,7 +57,7 @@ public class ShenandoahHeapRegion extends VMObject implements LiveRegionsProvide
|
||||
|
||||
private static CIntegerField RegionSizeBytesField;
|
||||
private static Field RegionStateField;
|
||||
private static CIntegerField RegionNumberField;
|
||||
private static CIntegerField RegionIndexField;
|
||||
private static CIntegerField RegionSizeBytesShiftField;
|
||||
|
||||
private static AddressField BottomField;
|
||||
@ -78,7 +78,7 @@ public class ShenandoahHeapRegion extends VMObject implements LiveRegionsProvide
|
||||
Type type = db.lookupType("ShenandoahHeapRegion");
|
||||
RegionSizeBytesField = type.getCIntegerField("RegionSizeBytes");
|
||||
RegionStateField = type.getField("_state");
|
||||
RegionNumberField = type.getCIntegerField("_region_number");
|
||||
RegionIndexField = type.getCIntegerField("_index");
|
||||
BottomField = type.getAddressField("_bottom");
|
||||
TopField = type.getAddressField("_top");
|
||||
EndField = type.getAddressField("_end");
|
||||
@ -127,14 +127,14 @@ public class ShenandoahHeapRegion extends VMObject implements LiveRegionsProvide
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int)regionNumber();
|
||||
return (int)index();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof ShenandoahHeapRegion) {
|
||||
ShenandoahHeapRegion otherRegion = (ShenandoahHeapRegion)other;
|
||||
return otherRegion.regionNumber() == regionNumber();
|
||||
return otherRegion.index() == index();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -170,7 +170,7 @@ public class ShenandoahHeapRegion extends VMObject implements LiveRegionsProvide
|
||||
}
|
||||
|
||||
private void handleHumongousRegion(List<MemRegion> res) {
|
||||
long index = regionNumber();
|
||||
long index = index();
|
||||
Address topAddr = top();
|
||||
ShenandoahHeapRegion region = heap.getRegion(++ index);
|
||||
while (region.regionState() == HumongousCont) {
|
||||
@ -217,8 +217,8 @@ public class ShenandoahHeapRegion extends VMObject implements LiveRegionsProvide
|
||||
}
|
||||
}
|
||||
|
||||
public long regionNumber() {
|
||||
return RegionNumberField.getValue(addr);
|
||||
public long index() {
|
||||
return RegionIndexField.getValue(addr);
|
||||
}
|
||||
|
||||
private boolean hasForwardee(Address rawPtr) {
|
||||
|
Loading…
Reference in New Issue
Block a user