--- old/src/share/vm/gc/g1/g1RemSet.cpp 2017-06-23 11:37:44.675168955 +0200 +++ new/src/share/vm/gc/g1/g1RemSet.cpp 2017-06-23 11:37:44.546164970 +0200 @@ -327,11 +327,11 @@ } G1ScanRSClosure::G1ScanRSClosure(G1RemSetScanState* scan_state, - G1ParPushHeapRSClosure* push_heap_cl, + G1ScanObjsDuringScanRSClosure* scan_obj_on_card, CodeBlobClosure* code_root_cl, uint worker_i) : _scan_state(scan_state), - _push_heap_cl(push_heap_cl), + _scan_objs_on_card_cl(scan_obj_on_card), _code_root_cl(code_root_cl), _strong_code_root_scan_time_sec(0.0), _cards_claimed(0), @@ -353,8 +353,8 @@ // but they're benign), which reduces the number of duplicate // scans (the rsets of the regions in the cset can intersect). _ct_bs->set_card_claimed(index); - _push_heap_cl->set_region(r); - r->oops_on_card_seq_iterate_careful(mr, _push_heap_cl); + _scan_objs_on_card_cl->set_region(r); + r->oops_on_card_seq_iterate_careful(mr, _scan_objs_on_card_cl); _cards_scanned++; } } @@ -413,7 +413,7 @@ return false; } -void G1RemSet::scan_rem_set(G1ParPushHeapRSClosure* oops_in_heap_closure, +void G1RemSet::scan_rem_set(G1ScanObjsDuringScanRSClosure* oops_in_heap_closure, CodeBlobClosure* heap_region_codeblobs, uint worker_i) { double rs_time_start = os::elapsedTime(); @@ -441,11 +441,11 @@ class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure { G1RemSet* _g1rs; DirtyCardQueue* _into_cset_dcq; - G1ParPushHeapRSClosure* _cl; + G1ScanObjsDuringUpdateRSClosure* _cl; public: RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h, DirtyCardQueue* into_cset_dcq, - G1ParPushHeapRSClosure* cl) : + G1ScanObjsDuringUpdateRSClosure* cl) : _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq), _cl(cl) {} @@ -455,9 +455,8 @@ // is during RSet updating within an evacuation pause. // In this case worker_i should be the id of a GC worker thread. assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); - assert(worker_i < ParallelGCThreads, "should be a GC worker"); - if (_g1rs->refine_card_during_gc(card_ptr, worker_i, _cl)) { + if (_g1rs->refine_card_during_gc(card_ptr, _cl)) { // 'card_ptr' contains references that point into the collection // set. We need to record the card in the DCQS // (_into_cset_dirty_card_queue_set) @@ -471,7 +470,7 @@ }; void G1RemSet::update_rem_set(DirtyCardQueue* into_cset_dcq, - G1ParPushHeapRSClosure* oops_in_heap_closure, + G1ScanObjsDuringUpdateRSClosure* oops_in_heap_closure, uint worker_i) { RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq, oops_in_heap_closure); @@ -489,7 +488,7 @@ HeapRegionRemSet::cleanup(); } -void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* cl, +void G1RemSet::oops_into_collection_set_do(G1ParScanThreadState* pss, CodeBlobClosure* heap_region_codeblobs, uint worker_i) { // A DirtyCardQueue that is used to hold cards containing references @@ -503,8 +502,14 @@ // DirtyCardQueueSet that is used to manage RSet updates DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set); - update_rem_set(&into_cset_dcq, cl, worker_i); - scan_rem_set(cl, heap_region_codeblobs, worker_i);; + { + G1ScanObjsDuringUpdateRSClosure cl(_g1, pss, worker_i); + update_rem_set(&into_cset_dcq, &cl, worker_i); + } + { + G1ScanObjsDuringScanRSClosure cl(_g1, pss); + scan_rem_set(&cl, heap_region_codeblobs, worker_i);; + } } void G1RemSet::prepare_for_oops_into_collection_set_do() { @@ -579,17 +584,6 @@ #endif } -G1UpdateRSOrPushRefOopClosure::G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, - G1ParPushHeapRSClosure* push_ref_cl, - bool record_refs_into_cset, - uint worker_i) : - _g1(g1h), - _from(NULL), - _record_refs_into_cset(record_refs_into_cset), - _has_refs_into_cset(false), - _push_ref_cl(push_ref_cl), - _worker_i(worker_i) { } - void G1RemSet::refine_card_concurrently(jbyte* card_ptr, uint worker_i) { assert(!_g1->is_gc_active(), "Only call concurrently"); @@ -740,8 +734,7 @@ } bool G1RemSet::refine_card_during_gc(jbyte* card_ptr, - uint worker_i, - G1ParPushHeapRSClosure* oops_in_heap_closure) { + G1ScanObjsDuringUpdateRSClosure* oops_in_heap_closure) { assert(_g1->is_gc_active(), "Only call during GC"); check_card_ptr(card_ptr, _ct_bs); @@ -775,19 +768,14 @@ MemRegion dirty_region(card_start, MIN2(scan_limit, card_end)); assert(!dirty_region.is_empty(), "sanity"); - G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1, - oops_in_heap_closure, - true, - worker_i); - update_rs_oop_cl.set_from(r); + oops_in_heap_closure->set_region(r); + oops_in_heap_closure->reset_has_refs_into_cset(); - bool card_processed = - r->oops_on_card_seq_iterate_careful(dirty_region, - &update_rs_oop_cl); + bool card_processed = r->oops_on_card_seq_iterate_careful(dirty_region, oops_in_heap_closure); assert(card_processed, "must be"); _conc_refine_cards++; - return update_rs_oop_cl.has_refs_into_cset(); + return oops_in_heap_closure->has_refs_into_cset(); } void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {