--- old/src/share/vm/gc/g1/g1RemSet.cpp 2017-07-10 14:22:44.718154444 +0200 +++ new/src/share/vm/gc/g1/g1RemSet.cpp 2017-07-10 14:22:44.622151466 +0200 @@ -36,6 +36,7 @@ #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionManager.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" +#include "gc/g1/suspendibleThreadSet.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" @@ -283,6 +284,7 @@ G1HotCardCache* hot_card_cache) : _g1(g1), _scan_state(new G1RemSetScanState()), + _refine_card_concurrently_cl(), _num_conc_refined_cards(0), _ct_bs(ct_bs), _g1p(_g1->g1_policy()), @@ -446,6 +448,17 @@ p->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, cl.strong_code_root_scan_time_sec()); } +bool G1RefineCardConcurrentlyClosure::do_card_ptr(jbyte* card_ptr, uint worker_i) { + G1CollectedHeap::heap()->g1_rem_set()->refine_card_concurrently(card_ptr, worker_i); + + if (SuspendibleThreadSet::should_yield()) { + // Caller will actually yield. + return false; + } + // Otherwise, we finished successfully; return true. + return true; +} + // Closure used for updating RSets and recording references that // point into the collection set. Only called during an // evacuation pause. @@ -519,7 +532,6 @@ } void G1RemSet::prepare_for_oops_into_collection_set_do() { - _g1->set_refine_cte_cl_concurrency(false); DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); dcqs.concatenate_logs(); @@ -528,8 +540,6 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() { G1GCPhaseTimes* phase_times = _g1->g1_policy()->phase_times(); - // Cleanup after copy - _g1->set_refine_cte_cl_concurrency(true); // Set all cards back to clean. double start = os::elapsedTime();