src/hotspot/share/gc/z/zGranuleMap.inline.hpp
changeset 54735 a9f729b641a3
parent 54162 f344a0c6e19e
child 58809 44dc3d796110
--- a/src/hotspot/share/gc/z/zGranuleMap.inline.hpp	Mon May 06 21:31:36 2019 -0700
+++ b/src/hotspot/share/gc/z/zGranuleMap.inline.hpp	Tue May 07 07:44:15 2019 +0200
@@ -31,11 +31,12 @@
 
 template <typename T>
 inline ZGranuleMap<T>::ZGranuleMap() :
-    _map(MmapArrayAllocator<T>::allocate(size(), mtGC)) {}
+    _size(ZAddressOffsetMax >> ZGranuleSizeShift),
+    _map(MmapArrayAllocator<T>::allocate(_size, mtGC)) {}
 
 template <typename T>
 inline ZGranuleMap<T>::~ZGranuleMap() {
-  MmapArrayAllocator<T>::free(_map, size());
+  MmapArrayAllocator<T>::free(_map, _size);
 }
 
 template <typename T>
@@ -43,17 +44,12 @@
   assert(!ZAddress::is_null(addr), "Invalid address");
 
   const size_t index = ZAddress::offset(addr) >> ZGranuleSizeShift;
-  assert(index < size(), "Invalid index");
+  assert(index < _size, "Invalid index");
 
   return index;
 }
 
 template <typename T>
-inline size_t ZGranuleMap<T>::size() const {
-  return ZAddressOffsetMax >> ZGranuleSizeShift;
-}
-
-template <typename T>
 inline T ZGranuleMap<T>::get(uintptr_t addr) const {
   const size_t index = index_for_addr(addr);
   return _map[index];
@@ -83,7 +79,7 @@
 
 template <typename T>
 inline bool ZGranuleMapIterator<T>::next(T* value) {
-  if (_next < _map->size()) {
+  if (_next < _map->_size) {
     *value = _map->_map[_next++];
     return true;
   }
@@ -94,7 +90,7 @@
 
 template <typename T>
 inline bool ZGranuleMapIterator<T>::next(T** value) {
-  if (_next < _map->size()) {
+  if (_next < _map->_size) {
     *value = _map->_map + _next++;
     return true;
   }