From 9ae0d5f81f205eb09649ec1d9e7c22ad9c5e6b38 Mon Sep 17 00:00:00 2001
From: Thomas Schatzl <tschatzl@openjdk.org>
Date: Fri, 25 Oct 2019 12:33:30 +0200
Subject: [PATCH] 8232777: Rename G1Policy::_max_rs_length as it is no maximum

Reviewed-by: kbarrett, sjohanss
---
 src/hotspot/share/gc/g1/g1CollectedHeap.cpp |  2 +-
 src/hotspot/share/gc/g1/g1Policy.cpp        | 14 +++++++-------
 src/hotspot/share/gc/g1/g1Policy.hpp        |  6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
index db6de824567..20f162b1e13 100644
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
@@ -4098,7 +4098,7 @@ private:
     _cl.complete_work();
 
     G1Policy* policy = G1CollectedHeap::heap()->policy();
-    policy->record_max_rs_length(_rs_length);
+    policy->record_rs_length(_rs_length);
     policy->cset_regions_freed();
   }
 public:
diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp
index 495961849c9..6fdf0e3e918 100644
--- a/src/hotspot/share/gc/g1/g1Policy.cpp
+++ b/src/hotspot/share/gc/g1/g1Policy.cpp
@@ -68,7 +68,7 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) :
   _reserve_regions(0),
   _young_gen_sizer(G1YoungGenSizer::create_gen_sizer()),
   _free_regions_at_end_of_collection(0),
-  _max_rs_length(0),
+  _rs_length(0),
   _rs_length_prediction(0),
   _pending_cards_at_gc_start(0),
   _pending_cards_at_prev_gc_end(0),
@@ -753,13 +753,13 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, size_t heap_use
       _analytics->report_cost_per_remset_card_ms(cost_per_remset_card_ms, this_pause_was_young_only);
     }
 
-    if (_max_rs_length > 0) {
+    if (_rs_length > 0) {
       double cards_per_entry_ratio =
-        (double) remset_cards_scanned / (double) _max_rs_length;
+        (double) remset_cards_scanned / (double) _rs_length;
       _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, this_pause_was_young_only);
     }
 
-    // This is defensive. For a while _max_rs_length could get
+    // This is defensive. For a while _rs_length could get
     // smaller than _recorded_rs_length which was causing
     // rs_length_diff to get very large and mess up the RSet length
     // predictions. The reason was unsafe concurrent updates to the
@@ -774,8 +774,8 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, size_t heap_use
     // conditional below just in case.
     size_t rs_length_diff = 0;
     size_t recorded_rs_length = _collection_set->recorded_rs_length();
-    if (_max_rs_length > recorded_rs_length) {
-      rs_length_diff = _max_rs_length - recorded_rs_length;
+    if (_rs_length > recorded_rs_length) {
+      rs_length_diff = _rs_length - recorded_rs_length;
     }
     _analytics->report_rs_length_diff((double) rs_length_diff);
 
@@ -806,7 +806,7 @@ void G1Policy::record_collection_pause_end(double pause_time_ms, size_t heap_use
     // During mixed gc we do not use them for young gen sizing.
     if (this_pause_was_young_only) {
       _analytics->report_pending_cards((double) _pending_cards_at_gc_start);
-      _analytics->report_rs_length((double) _max_rs_length);
+      _analytics->report_rs_length((double) _rs_length);
     }
   }
 
diff --git a/src/hotspot/share/gc/g1/g1Policy.hpp b/src/hotspot/share/gc/g1/g1Policy.hpp
index 218b0d6a2fd..46fb9966d27 100644
--- a/src/hotspot/share/gc/g1/g1Policy.hpp
+++ b/src/hotspot/share/gc/g1/g1Policy.hpp
@@ -96,7 +96,7 @@ class G1Policy: public CHeapObj<mtGC> {
 
   uint _free_regions_at_end_of_collection;
 
-  size_t _max_rs_length;
+  size_t _rs_length;
 
   size_t _rs_length_prediction;
 
@@ -136,8 +136,8 @@ public:
     hr->install_surv_rate_group(_survivor_surv_rate_group);
   }
 
-  void record_max_rs_length(size_t rs_length) {
-    _max_rs_length = rs_length;
+  void record_rs_length(size_t rs_length) {
+    _rs_length = rs_length;
   }
 
   double predict_base_elapsed_time_ms(size_t pending_cards) const;