diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 2429ad725dd..10b0d67db9b 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -1215,6 +1215,17 @@ public: } }; +class G1ObjectCountIsAliveClosure: public BoolObjectClosure { + G1CollectedHeap* _g1h; +public: + G1ObjectCountIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) { } + + bool do_object_b(oop obj) { + return obj != nullptr && + (!_g1h->is_in_reserved(obj) || !_g1h->is_obj_dead(obj)); + } +}; + void G1ConcurrentMark::remark() { assert_at_safepoint_on_vm_thread(); @@ -1297,6 +1308,12 @@ void G1ConcurrentMark::remark() { reset_at_marking_complete(); G1CollectedHeap::finish_codecache_marking_cycle(); + + { + GCTraceTime(Debug, gc, phases) debug("Report Object Count", _gc_timer_cm); + G1ObjectCountIsAliveClosure is_alive(_g1h); + _gc_tracer_cm->report_object_count_after_gc(&is_alive, _g1h->workers()); + } } else { // We overflowed. Restart concurrent marking. _restart_for_overflow = true; @@ -1308,11 +1325,6 @@ void G1ConcurrentMark::remark() { reset_marking_for_restart(); } - { - GCTraceTime(Debug, gc, phases) debug("Report Object Count", _gc_timer_cm); - report_object_count(mark_finished); - } - // Statistics double now = os::elapsedTime(); _remark_mark_times.add((mark_work_end - start) * 1000.0); @@ -1715,29 +1727,6 @@ void G1ConcurrentMark::preclean() { _gc_timer_cm); } -class G1ObjectCountIsAliveClosure: public BoolObjectClosure { - G1CollectedHeap* _g1h; -public: - G1ObjectCountIsAliveClosure(G1CollectedHeap* g1h) : _g1h(g1h) { } - - bool do_object_b(oop obj) { - return obj != nullptr && - (!_g1h->is_in_reserved(obj) || !_g1h->is_obj_dead(obj)); - } -}; - -void G1ConcurrentMark::report_object_count(bool mark_completed) { - // Depending on the completion of the marking liveness needs to be determined - // using either the bitmap or after the cycle using the scrubbing information. - if (mark_completed) { - G1ObjectCountIsAliveClosure is_alive(_g1h); - _gc_tracer_cm->report_object_count_after_gc(&is_alive, _g1h->workers()); - } else { - G1CMIsAliveClosure is_alive(_g1h); - _gc_tracer_cm->report_object_count_after_gc(&is_alive, _g1h->workers()); - } -} - // Closure for marking entries in SATB buffers. class G1CMSATBBufferClosure : public SATBBufferClosure { private: diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index a824d50ac5f..1e4aa9af41f 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -375,8 +375,6 @@ class G1ConcurrentMark : public CHeapObj { void weak_refs_work(); - void report_object_count(bool mark_completed); - void reclaim_empty_regions(); // After reclaiming empty regions, update heap sizes.