src/hotspot/share/gc/g1/heapRegionSet.hpp
changeset 59062 6530de931b8e
parent 59060 fce1fa1bdc91
--- a/src/hotspot/share/gc/g1/heapRegionSet.hpp	Wed Nov 13 10:49:32 2019 -0800
+++ b/src/hotspot/share/gc/g1/heapRegionSet.hpp	Wed Nov 13 10:51:41 2019 -0800
@@ -136,11 +136,33 @@
 // add / remove one region at a time or concatenate two lists.
 
 class FreeRegionListIterator;
+class G1NUMA;
 
 class FreeRegionList : public HeapRegionSetBase {
   friend class FreeRegionListIterator;
 
 private:
+
+  // This class is only initialized if there are multiple active nodes.
+  class NodeInfo : public CHeapObj<mtGC> {
+    G1NUMA* _numa;
+    uint*   _length_of_node;
+    uint    _num_nodes;
+
+  public:
+    NodeInfo();
+    ~NodeInfo();
+
+    inline void increase_length(uint node_index);
+    inline void decrease_length(uint node_index);
+
+    inline uint length(uint index) const;
+
+    void clear();
+
+    void add(NodeInfo* info);
+  };
+
   HeapRegion* _head;
   HeapRegion* _tail;
 
@@ -148,20 +170,23 @@
   // time. It helps to improve performance when adding several ordered items in a row.
   HeapRegion* _last;
 
+  NodeInfo*   _node_info;
+
   static uint _unrealistically_long_length;
 
   inline HeapRegion* remove_from_head_impl();
   inline HeapRegion* remove_from_tail_impl();
 
+  inline void increase_length(uint node_index);
+  inline void decrease_length(uint node_index);
+
 protected:
   // See the comment for HeapRegionSetBase::clear()
   virtual void clear();
 
 public:
-  FreeRegionList(const char* name, HeapRegionSetChecker* checker = NULL):
-    HeapRegionSetBase(name, checker) {
-    clear();
-  }
+  FreeRegionList(const char* name, HeapRegionSetChecker* checker = NULL);
+  ~FreeRegionList();
 
   void verify_list();
 
@@ -182,8 +207,7 @@
   HeapRegion* remove_region(bool from_head);
 
   HeapRegion* remove_region_with_node_index(bool from_head,
-                                            const uint requested_node_index,
-                                            uint* region_node_index);
+                                            uint requested_node_index);
 
   // Merge two ordered lists. The result is also ordered. The order is
   // determined by hrm_index.
@@ -200,6 +224,9 @@
   virtual void verify();
 
   uint num_of_regions_in_range(uint start, uint end) const;
+
+  using HeapRegionSetBase::length;
+  uint length(uint node_index) const;
 };
 
 // Iterator class that provides a convenient way to iterate over the