6906565: G1: deal with compilation warning in g1MemoryPool.hpp

Size_t max_size() hides size_t max_size() const.

Reviewed-by: jmasa, ysr
diff --git a/hotspot/src/share/vm/services/g1MemoryPool.cpp b/hotspot/src/share/vm/services/g1MemoryPool.cpp
index 9a124da..6d19adf 100644
--- a/hotspot/src/share/vm/services/g1MemoryPool.cpp
+++ b/hotspot/src/share/vm/services/g1MemoryPool.cpp
@@ -116,7 +116,7 @@
   size_t initial_sz = initial_size();
   size_t max_sz     = max_size();
   size_t used       = used_in_bytes();
-  size_t committed  = eden_space_committed();
+  size_t committed  = eden_space_committed(_g1h);
 
   return MemoryUsage(initial_sz, used, committed, max_sz);
 }
@@ -133,7 +133,7 @@
   size_t initial_sz = initial_size();
   size_t max_sz     = max_size();
   size_t used       = used_in_bytes();
-  size_t committed  = survivor_space_committed();
+  size_t committed  = survivor_space_committed(_g1h);
 
   return MemoryUsage(initial_sz, used, committed, max_sz);
 }
@@ -150,7 +150,7 @@
   size_t initial_sz = initial_size();
   size_t max_sz     = max_size();
   size_t used       = used_in_bytes();
-  size_t committed  = old_space_committed();
+  size_t committed  = old_space_committed(_g1h);
 
   return MemoryUsage(initial_sz, used, committed, max_sz);
 }
diff --git a/hotspot/src/share/vm/services/g1MemoryPool.hpp b/hotspot/src/share/vm/services/g1MemoryPool.hpp
index 12b3662..cfc61e5 100644
--- a/hotspot/src/share/vm/services/g1MemoryPool.hpp
+++ b/hotspot/src/share/vm/services/g1MemoryPool.hpp
@@ -103,8 +103,6 @@
 // we can easily share them among the subclasses.
 class G1MemoryPoolSuper : public CollectedMemoryPool {
 private:
-  G1CollectedHeap* _g1h;
-
   // It returns x - y if x > y, 0 otherwise.
   // As described in the comment above, some of the inputs to the
   // calculations we have to do are obtained concurrently and hence
@@ -121,6 +119,8 @@
   }
 
 protected:
+  G1CollectedHeap* _g1h;
+
   // Would only be called from subclasses.
   G1MemoryPoolSuper(G1CollectedHeap* g1h,
                     const char* name,
@@ -152,38 +152,6 @@
   static size_t old_space_committed(G1CollectedHeap* g1h);
   static size_t old_space_used(G1CollectedHeap* g1h);
   static size_t old_space_max(G1CollectedHeap* g1h);
-
-  // The non-static versions are included for convenience.
-
-  size_t eden_space_committed() {
-    return eden_space_committed(_g1h);
-  }
-  size_t eden_space_used() {
-    return eden_space_used(_g1h);
-  }
-  size_t eden_space_max() {
-    return eden_space_max(_g1h);
-  }
-
-  size_t survivor_space_committed() {
-    return survivor_space_committed(_g1h);
-  }
-  size_t survivor_space_used() {
-    return survivor_space_used(_g1h);
-  }
-  size_t survivor_space_max() {
-    return survivor_space_max(_g1h);
-  }
-
-  size_t old_space_committed() {
-    return old_space_committed(_g1h);
-  }
-  size_t old_space_used() {
-    return old_space_used(_g1h);
-  }
-  size_t old_space_max() {
-    return old_space_max(_g1h);
-  }
 };
 
 // Memory pool that represents the G1 eden.
@@ -192,10 +160,10 @@
   G1EdenPool(G1CollectedHeap* g1h);
 
   size_t used_in_bytes() {
-    return eden_space_used();
+    return eden_space_used(_g1h);
   }
-  size_t max_size() {
-    return eden_space_max();
+  size_t max_size() const {
+    return eden_space_max(_g1h);
   }
   MemoryUsage get_memory_usage();
 };
@@ -206,10 +174,10 @@
   G1SurvivorPool(G1CollectedHeap* g1h);
 
   size_t used_in_bytes() {
-    return survivor_space_used();
+    return survivor_space_used(_g1h);
   }
-  size_t max_size() {
-    return survivor_space_max();
+  size_t max_size() const {
+    return survivor_space_max(_g1h);
   }
   MemoryUsage get_memory_usage();
 };
@@ -220,10 +188,10 @@
   G1OldGenPool(G1CollectedHeap* g1h);
 
   size_t used_in_bytes() {
-    return old_space_used();
+    return old_space_used(_g1h);
   }
-  size_t max_size() {
-    return old_space_max();
+  size_t max_size() const {
+    return old_space_max(_g1h);
   }
   MemoryUsage get_memory_usage();
 };