< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Print this page
rev 49944 : imported patch 8201492-properly-implement-non-contiguous-reference-processing
rev 49949 : imported patch 8202021-cleanup-referenceprocessor
rev 49951 : imported patch 8202017-reference-processor-remove-enqueue
rev 49953 : imported patch 8201491-precleaning

*** 1704,1713 **** --- 1704,1751 ---- // class unloading is disabled. _g1h->partial_cleaning(&g1_is_alive, false, false, G1StringDedup::is_enabled()); } } + class G1PrecleanYieldClosure : public YieldClosure { + G1ConcurrentMark* _cm; + + public: + G1PrecleanYieldClosure(G1ConcurrentMark* cm) : _cm(cm) { } + + virtual bool should_return() { + return _cm->has_aborted(); + } + + virtual bool should_return_fine_grain() { + _cm->do_yield_check(); + return _cm->has_aborted(); + } + }; + + void G1ConcurrentMark::preclean() { + assert(G1UseReferencePrecleaning, "Precleaning must be enabled."); + + SuspendibleThreadSetJoiner joiner; + + G1CMKeepAliveAndDrainClosure keep_alive(this, task(0), true /* is_serial */); + G1CMDrainMarkingStackClosure drain_mark_stack(this, task(0), true /* is_serial */); + + set_concurrency_and_phase(1, true); + + G1PrecleanYieldClosure yield_cl(this); + + ReferenceProcessor* rp = _g1h->ref_processor_cm(); + // Precleaning is single threaded. Temporarily disable MT discovery. + ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(rp, false); + rp->preclean_discovered_references(rp->is_alive_non_header(), + &keep_alive, + &drain_mark_stack, + &yield_cl, + _gc_timer_cm); + } + // When sampling object counts, we already swapped the mark bitmaps, so we need to use // the prev bitmap determining liveness. class G1ObjectCountIsAliveClosure: public BoolObjectClosure { G1CollectedHeap* _g1h; public:
< prev index next >