8223162: Improve ergonomics for Sparse PRT entry sizing
authortschatzl
Mon, 03 Jun 2019 10:50:14 +0200
changeset 55148 0dab93cb3b0c
parent 55147 d22206f24d59
child 55149 00f7fce88e25
8223162: Improve ergonomics for Sparse PRT entry sizing Summary: Scale Sparse PRT table sizes exponentially according to region size. Reviewed-by: kbarrett, sangheki
src/hotspot/share/gc/g1/heapRegionRemSet.cpp
src/hotspot/share/gc/g1/heapRegionRemSet.hpp
src/hotspot/share/gc/g1/sparsePRT.hpp
--- a/src/hotspot/share/gc/g1/heapRegionRemSet.cpp	Sun Jun 02 17:13:31 2019 -0400
+++ b/src/hotspot/share/gc/g1/heapRegionRemSet.cpp	Mon Jun 03 10:50:14 2019 +0200
@@ -614,12 +614,12 @@
 }
 
 void HeapRegionRemSet::setup_remset_size() {
-  // Setup sparse and fine-grain tables sizes.
-  // table_size = base * (log(region_size / 1M) + 1)
   const int LOG_M = 20;
-  int region_size_log_mb = MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0);
+  guarantee(HeapRegion::LogOfHRGrainBytes >= LOG_M, "Code assumes the region size >= 1M, but is " SIZE_FORMAT "B", HeapRegion::GrainBytes);
+
+  int region_size_log_mb = HeapRegion::LogOfHRGrainBytes - LOG_M;
   if (FLAG_IS_DEFAULT(G1RSetSparseRegionEntries)) {
-    G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * (region_size_log_mb + 1);
+    G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * ((size_t)1 << (region_size_log_mb + 1));
   }
   if (FLAG_IS_DEFAULT(G1RSetRegionEntries)) {
     G1RSetRegionEntries = G1RSetRegionEntriesBase * (region_size_log_mb + 1);
--- a/src/hotspot/share/gc/g1/heapRegionRemSet.hpp	Sun Jun 02 17:13:31 2019 -0400
+++ b/src/hotspot/share/gc/g1/heapRegionRemSet.hpp	Mon Jun 03 10:50:14 2019 +0200
@@ -179,6 +179,7 @@
 public:
   HeapRegionRemSet(G1BlockOffsetTable* bot, HeapRegion* hr);
 
+  // Setup sparse and fine-grain tables sizes.
   static void setup_remset_size();
 
   bool cardset_is_empty() const {
--- a/src/hotspot/share/gc/g1/sparsePRT.hpp	Sun Jun 02 17:13:31 2019 -0400
+++ b/src/hotspot/share/gc/g1/sparsePRT.hpp	Mon Jun 03 10:50:14 2019 +0200
@@ -218,9 +218,7 @@
 
   RSHashTable* _table;
 
-  enum SomeAdditionalPrivateConstants {
-    InitialCapacity = 16
-  };
+  static const size_t InitialCapacity = 8;
 
   void expand();