8242353: Shenandoah: micro-optimize region liveness handling
Reviewed-by: rkennke
This commit is contained in:
parent
4c4271f283
commit
7b870e70d0
@ -75,20 +75,15 @@ inline void ShenandoahConcurrentMark::count_liveness(jushort* live_data, oop obj
|
||||
if (!region->is_humongous_start()) {
|
||||
assert(!region->is_humongous(), "Cannot have continuations here");
|
||||
size_t max = (1 << (sizeof(jushort) * 8)) - 1;
|
||||
if (size >= max) {
|
||||
// too big, add to region data directly
|
||||
region->increase_live_data_gc_words(size);
|
||||
jushort cur = live_data[region_idx];
|
||||
size_t new_val = size + cur;
|
||||
if (new_val >= max) {
|
||||
// overflow, flush to region data
|
||||
region->increase_live_data_gc_words(new_val);
|
||||
live_data[region_idx] = 0;
|
||||
} else {
|
||||
jushort cur = live_data[region_idx];
|
||||
size_t new_val = cur + size;
|
||||
if (new_val >= max) {
|
||||
// overflow, flush to region data
|
||||
region->increase_live_data_gc_words(new_val);
|
||||
live_data[region_idx] = 0;
|
||||
} else {
|
||||
// still good, remember in locals
|
||||
live_data[region_idx] = (jushort) new_val;
|
||||
}
|
||||
// still good, remember in locals
|
||||
live_data[region_idx] = (jushort) new_val;
|
||||
}
|
||||
} else {
|
||||
shenandoah_assert_in_correct_region(NULL, obj);
|
||||
|
@ -3024,9 +3024,9 @@ void ShenandoahHeap::flush_liveness_cache(uint worker_id) {
|
||||
assert(_liveness_cache != NULL, "sanity");
|
||||
jushort* ld = _liveness_cache[worker_id];
|
||||
for (uint i = 0; i < num_regions(); i++) {
|
||||
ShenandoahHeapRegion* r = get_region(i);
|
||||
jushort live = ld[i];
|
||||
if (live > 0) {
|
||||
ShenandoahHeapRegion* r = get_region(i);
|
||||
r->increase_live_data_gc_words(live);
|
||||
ld[i] = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user