--- old/src/hotspot/share/gc/g1/heapRegionSet.hpp 2019-11-01 16:13:24.884400501 -0700 +++ new/src/hotspot/share/gc/g1/heapRegionSet.hpp 2019-11-01 16:13:24.536400490 -0700 @@ -136,6 +136,7 @@ // add / remove one region at a time or concatenate two lists. class FreeRegionListIterator; +class NodeInfo; class FreeRegionList : public HeapRegionSetBase { friend class FreeRegionListIterator; @@ -148,20 +149,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 +186,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); + const uint requested_node_index); // Merge two ordered lists. The result is also ordered. The order is // determined by hrm_index. @@ -200,6 +203,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 @@ -234,4 +240,26 @@ } }; +class G1NUMA; + +// This class is only initialized if there are multiple active nodes. +class NodeInfo : public CHeapObj { + 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); +}; + #endif // SHARE_GC_G1_HEAPREGIONSET_HPP