--- old/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp 2020-08-19 12:42:47.519078409 +0200 +++ new/src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp 2020-08-19 12:42:47.155076604 +0200 @@ -32,51 +32,38 @@ // Track allocation details in the old generation. class G1OldGenAllocationTracker : public CHeapObj { - // New bytes allocated in old gen between the end of the last GC and - // the end of the GC before that. This includes humongous object allocation. - size_t _last_period_old_bytes; - // New bytes allocated in humongous regions between the end of the last GC and - // the end of the GC before that. - size_t _last_period_humongous_bytes; + // Total number of bytes allocated in the old generaton during + // last mutator period. + size_t _last_period_old_gen_bytes; + // Total growth of the old geneneration for last mutator period, + // taking eager reclaim into consideration. + size_t _last_period_old_gen_growth; + // Total size of humongous objects for last gc. size_t _humongous_bytes_after_last_gc; - size_t _humongous_bytes_after_penultimate_gc; + // Non-humongous old generation allocations during last mutator period. size_t _allocated_bytes_since_last_gc; + // Humongous allocations during last mutator period. size_t _allocated_humongous_bytes_since_last_gc; public: G1OldGenAllocationTracker(); - // Add the given number of bytes to the total number of allocated bytes in the old gen. - void add_allocated_bytes_since_last_gc(size_t bytes) { _allocated_bytes_since_last_gc += bytes; } - void add_allocated_humongous_bytes_since_last_gc(size_t bytes) { - _allocated_humongous_bytes_since_last_gc += bytes; - _allocated_bytes_since_last_gc += bytes; - } + void add_allocated_bytes_since_last_gc(size_t bytes) { _allocated_bytes_since_last_gc += bytes; } + void add_allocated_humongous_bytes_since_last_gc(size_t bytes) { _allocated_humongous_bytes_since_last_gc += bytes; } - // Record a humongous allocation during a collection pause. - // In g1CollectedHeap, when a humongous allocation fails, the heap will attempt - // to trigger a GC and try to allocate the required bytes during it. These bytes - // are then not counted in any mutator period but as survived bytes after GC. - // Otherwise, they would distort our estimation for how many humongous bytes are - // freed in a mutator period. + // Record a humongous allocation in a collection pause. This allocation + // is accounted to the previous mutator period. void record_collection_pause_humongous_allocation(size_t bytes) { _humongous_bytes_after_last_gc += bytes; } - size_t last_period_old_bytes() const { return _last_period_old_bytes; } + size_t last_period_old_gen_bytes() const { return _last_period_old_gen_bytes; } + size_t last_period_old_gen_growth() const { return _last_period_old_gen_growth; }; - // Reset stats after a collection. + // Calculates and resets stats after a collection. void reset_after_gc(size_t humongous_bytes_after_gc); - - // This is used by Adaptive IHOP to sample the old gen allocation rate. - // Different from the regular old gen allocation rate, this method considers the - // humongous objects that can be reclaimed early by young GCs. Since we cannot - // track the life cycle of individual humongous objects, we assume that such - // objects were all newly allocated and not survivors, unless more were - // reclaimed than allocated. - size_t last_period_net_survived_old_bytes() const; }; -#endif // SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP \ No newline at end of file +#endif // SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP