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