diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/src/share/vm/gc_implementation/g1/concurrentMark.cpp index d565f3d0c70540709c4255d59849e268b2df8e75..7df7b7fee8dbec5f0dfa1949b9def6084299e867 100644 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -3332,6 +3332,7 @@ void ConcurrentMark::aggregate_count_data() { } else { g1_par_agg_task.work(0); } + _g1h->allocation_context_stats().update_at_remark(); } // Clear the per-worker arrays used to store the per-region counting data diff --git a/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp b/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp index 788de8aa36c4b352b2a604d0e0f7cfc66e8176d3..3f114cbf1e480845202fab1c73b2869ddf80e886 100644 --- a/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp +++ b/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp @@ -41,4 +41,11 @@ public: } }; +class AllocationContextStats: public StackObj { +public: + inline void clear() { } + inline void update(bool full_gc) { } + inline void update_at_remark() { } +}; + #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATIONCONTEXT_HPP diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index ac022eac84dcdff8e6b6ee414970ff04efe73a20..a05e0a4f310b2ebad983c4f494ec272e8c3344ee 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3585,7 +3585,7 @@ void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { } } -void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) { +void G1CollectedHeap::gc_epilogue(bool full) { if (G1SummarizeRSetStats && (G1SummarizeRSetStatsPeriod > 0) && @@ -3602,6 +3602,7 @@ void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) { // always_do_update_barrier = true; resize_all_tlabs(); + allocation_context_stats().update(full); // We have just completed a GC. Update the soft reference // policy with the new heap occupancy diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 63a63b015abe75214a93fceb2d26665678f81dab..2587bc2299e41f8b3c45020ceb432220527e921b 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -263,6 +263,9 @@ private: // Class that handles the different kinds of allocations. G1Allocator* _allocator; + // Statistics for each allocation context + AllocationContextStats _allocation_context_stats; + // PLAB sizing policy for survivors. PLABStats _survivor_plab_stats; @@ -656,6 +659,8 @@ public: // Determines PLAB size for a particular allocation purpose. size_t desired_plab_sz(GCAllocPurpose purpose); + inline AllocationContextStats& allocation_context_stats(); + // Do anything common to GC's. virtual void gc_prologue(bool full); virtual void gc_epilogue(bool full); diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp index 3e848d2e338c1680d0ad6bada87b686091dbe3bb..32357bc77490862cfb30f5e1f192f2495409d78b 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @@ -37,6 +37,10 @@ // Inline functions for G1CollectedHeap +inline AllocationContextStats& G1CollectedHeap::allocation_context_stats() { + return _allocation_context_stats; +} + // Return the region with the given index. It assumes the index is valid. inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm.at(index); }