--- old/src/hotspot/share/gc/g1/g1EdenRegions.hpp 2019-11-01 16:13:10.720400064 -0700 +++ new/src/hotspot/share/gc/g1/g1EdenRegions.hpp 2019-11-01 16:13:10.380400054 -0700 @@ -25,6 +25,7 @@ #ifndef SHARE_GC_G1_G1EDENREGIONS_HPP #define SHARE_GC_G1_G1EDENREGIONS_HPP +#include "gc/g1/g1RegionCounts.hpp" #include "gc/g1/heapRegion.hpp" #include "runtime/globals.hpp" #include "utilities/debug.hpp" @@ -35,18 +36,25 @@ // Sum of used bytes from all retired eden regions. // I.e. updated when mutator regions are retired. volatile size_t _used_bytes; + G1RegionCounts _region_counts; public: - G1EdenRegions() : _length(0), _used_bytes(0) { } + G1EdenRegions() : _length(0), _used_bytes(0), _region_counts() { } - void add(HeapRegion* hr) { + virtual uint add(HeapRegion* hr) { assert(!hr->is_eden(), "should not already be set"); _length++; + return _region_counts.add(hr); } - void clear() { _length = 0; _used_bytes = 0; } + void clear() { + _length = 0; + _used_bytes = 0; + _region_counts.clear(); + } uint length() const { return _length; } + uint length(uint node_index) const { return _region_counts.length(node_index); } size_t used_bytes() const { return _used_bytes; }