--- old/src/share/vm/gc/g1/g1CollectedHeap.cpp 2017-07-10 14:17:02.280534387 +0200 +++ new/src/share/vm/gc/g1/g1CollectedHeap.cpp 2017-07-10 14:17:02.179531254 +0200 @@ -1660,6 +1660,14 @@ return result; } +jint G1CollectedHeap::initialize_concurrent_refinement() { + _refine_cte_cl = new RefineCardTableEntryClosure(); + + jint ecode = JNI_OK; + _cg1r = ConcurrentG1Refine::create(_refine_cte_cl, &ecode); + return ecode; +} + jint G1CollectedHeap::initialize() { CollectedHeap::pre_initialize(); os::enable_vtime(); @@ -1808,11 +1816,8 @@ G1SATBProcessCompletedThreshold, Shared_SATB_Q_lock); - _refine_cte_cl = new RefineCardTableEntryClosure(); - - jint ecode = JNI_OK; - _cg1r = ConcurrentG1Refine::create(_refine_cte_cl, &ecode); - if (_cg1r == NULL) { + jint ecode = initialize_concurrent_refinement(); + if (ecode != JNI_OK) { return ecode; } @@ -1858,8 +1863,6 @@ _collection_set.initialize(max_regions()); - _g1_rem_set->initialize_periodic_summary_info(); - return JNI_OK; } --- old/src/share/vm/gc/g1/g1CollectedHeap.hpp 2017-07-10 14:17:02.870552685 +0200 +++ new/src/share/vm/gc/g1/g1CollectedHeap.hpp 2017-07-10 14:17:02.773549677 +0200 @@ -967,6 +967,9 @@ // May not return if something goes wrong. G1CollectedHeap(G1CollectorPolicy* policy); +private: + jint initialize_concurrent_refinement(); +public: // Initialize the G1CollectedHeap to have the initial and // maximum sizes and remembered and barrier sets // specified by the policy object. --- old/src/share/vm/gc/g1/g1RemSet.cpp 2017-07-10 14:17:03.415569588 +0200 +++ new/src/share/vm/gc/g1/g1RemSet.cpp 2017-07-10 14:17:03.318566579 +0200 @@ -783,20 +783,11 @@ return update_rs_cl->has_refs_into_cset(); } -void G1RemSet::initialize_periodic_summary_info() { - if (log_is_enabled(Trace, gc, remset)) { - _prev_period_summary.initialize(this); - } -} - void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) { if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) && (period_count % G1SummarizeRSetStatsPeriod == 0)) { - assert(_prev_period_summary.initialized(), "Periodic remembered set summary must be initialized."); - G1RemSetSummary current; - current.initialize(this); _prev_period_summary.subtract_from(¤t); Log(gc, remset) log; @@ -813,7 +804,6 @@ if (log.is_trace()) { log.trace(" Cumulative RS summary"); G1RemSetSummary current; - current.initialize(this); ResourceMark rm; current.print_on(log.trace_stream()); } --- old/src/share/vm/gc/g1/g1RemSet.hpp 2017-07-10 14:17:03.979587080 +0200 +++ new/src/share/vm/gc/g1/g1RemSet.hpp 2017-07-10 14:17:03.883584102 +0200 @@ -142,7 +142,6 @@ // Print accumulated summary info from the start of the VM. void print_summary_info(); - void initialize_periodic_summary_info(); // Print accumulated summary info from the last time called. void print_periodic_summary_info(const char* header, uint period_count); --- old/src/share/vm/gc/g1/g1RemSetSummary.cpp 2017-07-10 14:17:04.509603517 +0200 +++ new/src/share/vm/gc/g1/g1RemSetSummary.cpp 2017-07-10 14:17:04.412600509 +0200 @@ -51,6 +51,10 @@ } }; +G1RemSet* G1RemSetSummary::remset() const { + return G1CollectedHeap::heap()->g1_rem_set(); +} + void G1RemSetSummary::update() { _num_conc_refined_cards = remset()->num_conc_refined_cards(); DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); @@ -79,27 +83,16 @@ return _rs_threads_vtimes[thread]; } -void G1RemSetSummary::initialize(G1RemSet* remset) { - assert(_rs_threads_vtimes == NULL, "just checking"); - assert(remset != NULL, "just checking"); - - _remset = remset; - _num_vtimes = ConcurrentG1Refine::thread_num(); - _rs_threads_vtimes = NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC); - memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes); - - update(); -} - G1RemSetSummary::G1RemSetSummary() : - _remset(NULL), _num_conc_refined_cards(0), _num_processed_buf_mutator(0), _num_processed_buf_rs_threads(0), _num_coarsenings(0), - _rs_threads_vtimes(NULL), - _num_vtimes(0), + _num_vtimes(ConcurrentG1Refine::thread_num()), + _rs_threads_vtimes(NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC)), _sampling_thread_vtime(0.0f) { + + memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes); } G1RemSetSummary::~G1RemSetSummary() { --- old/src/share/vm/gc/g1/g1RemSetSummary.hpp 2017-07-10 14:17:05.066620792 +0200 +++ new/src/share/vm/gc/g1/g1RemSetSummary.hpp 2017-07-10 14:17:04.970617814 +0200 @@ -36,11 +36,7 @@ private: friend class GetRSThreadVTimeClosure; - G1RemSet* _remset; - - G1RemSet* remset() const { - return _remset; - } + G1RemSet* remset() const; size_t _num_conc_refined_cards; size_t _num_processed_buf_mutator; @@ -48,8 +44,8 @@ size_t _num_coarsenings; - double* _rs_threads_vtimes; size_t _num_vtimes; + double* _rs_threads_vtimes; double _sampling_thread_vtime; @@ -70,10 +66,6 @@ // subtract all counters from the other summary, and set them in the current void subtract_from(G1RemSetSummary* other); - // initialize and get the first sampling - void initialize(G1RemSet* remset); - bool const initialized() { return _rs_threads_vtimes != NULL; } - void print_on(outputStream* out); double rs_thread_vtime(uint thread) const;