src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
changeset 51007 fc9dd181d70e
parent 50752 9d62da00bf15
child 51292 0538a5cdb474
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Mon Jul 09 12:20:56 2018 +0800
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Mon Jul 09 10:19:51 2018 +0200
@@ -1024,11 +1024,17 @@
 
     uint _num_regions_selected_for_rebuild;  // The number of regions actually selected for rebuild.
 
-    void update_remset_before_rebuild(HeapRegion * hr) {
+    void update_remset_before_rebuild(HeapRegion* hr) {
       G1RemSetTrackingPolicy* tracking_policy = _g1h->g1_policy()->remset_tracker();
 
-      size_t const live_bytes = _cm->liveness(hr->hrm_index()) * HeapWordSize;
-      bool selected_for_rebuild = tracking_policy->update_before_rebuild(hr, live_bytes);
+      bool selected_for_rebuild;
+      if (hr->is_humongous()) {
+        bool const is_live = _cm->liveness(hr->humongous_start_region()->hrm_index()) > 0;
+        selected_for_rebuild = tracking_policy->update_humongous_before_rebuild(hr, is_live);
+      } else {
+        size_t const live_bytes = _cm->liveness(hr->hrm_index());
+        selected_for_rebuild = tracking_policy->update_before_rebuild(hr, live_bytes);
+      }
       if (selected_for_rebuild) {
         _num_regions_selected_for_rebuild++;
       }