< prev index next >

src/hotspot/share/gc/g1/heapRegionSet.inline.hpp

Print this page
rev 56448 : imported patch 8220310.mut.0
rev 56449 : imported patch 8220310.mut.1
rev 56450 : imported patch 8220310.mut.2
rev 56451 : imported patch 8220310.mut.3
rev 56452 : [mq]: 8220310.mut.4
rev 56461 : imported patch 8220312.stat.2
rev 56463 : [mq]: 8220312.stat.4

@@ -93,10 +93,12 @@
     // The list was empty
     _tail = hr;
     _head = hr;
   }
   _last = hr;
+
+  increase_length(hr->node_index());
 }
 
 inline HeapRegion* FreeRegionList::remove_from_head_impl() {
   HeapRegion* result = _head;
   _head = result->next();

@@ -143,16 +145,18 @@
     _last = NULL;
   }
 
   // remove() will verify the region and check mt safety.
   remove(hr);
+
+  decrease_length(hr->node_index());
+
   return hr;
 }
 
 inline HeapRegion* FreeRegionList::remove_region_with_node_index(bool from_head,
-                                                                 const uint requested_node_index,
-                                                                 uint* allocated_node_index) {
+                                                                 const uint requested_node_index) {
   assert(UseNUMA, "Invariant");
 
   const uint max_search_depth = G1NUMA::numa()->max_search_depth();
   HeapRegion* cur;
 

@@ -200,13 +204,50 @@
   if (_last == cur) {
     _last = NULL;
   }
 
   remove(cur);
-  if (allocated_node_index != NULL) {
-    *allocated_node_index = cur->node_index();
-  }
+  decrease_length(cur->node_index());
 
   return cur;
 }
 
+inline void NodeInfo::increase_length(uint node_index) {
+  if (node_index < _num_nodes) {
+    _length_of_node[node_index] += 1;
+  }
+}
+
+inline void NodeInfo::decrease_length(uint node_index) {
+  if (node_index < _num_nodes) {
+    assert(_length_of_node[node_index] > 0,
+           "Current length %u should be greater than zero for node %u",
+           _length_of_node[node_index], node_index);
+    _length_of_node[node_index] -= 1;
+  }
+}
+
+inline uint NodeInfo::length(uint node_index) const {
+  return _length_of_node[node_index];
+}
+
+inline void FreeRegionList::increase_length(uint node_index) {
+  if (_node_info != NULL) {
+    return _node_info->increase_length(node_index);
+  }
+}
+
+inline void FreeRegionList::decrease_length(uint node_index) {
+  if (_node_info != NULL) {
+    return _node_info->decrease_length(node_index);
+  }
+}
+
+inline uint FreeRegionList::length(uint node_index) const {
+  if (_node_info != NULL) {
+    return _node_info->length(node_index);
+  } else {
+    return 0;
+  }
+}
+
 #endif // SHARE_GC_G1_HEAPREGIONSET_INLINE_HPP
< prev index next >