changeset 60821:f275c9540215

8242353: Shenandoah: micro-optimize region liveness handling Reviewed-by: rkennke
author shade
date Wed, 08 Apr 2020 13:44:57 +0200
parents 55db80785046
children 9e3539baac38
files src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
diffstat 2 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp	Wed Apr 08 11:16:56 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp	Wed Apr 08 13:44:57 2020 +0200
@@ -75,20 +75,15 @@
   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);
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Apr 08 11:16:56 2020 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Wed Apr 08 13:44:57 2020 +0200
@@ -3024,9 +3024,9 @@
   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;
     }