@@ -79,18 +79,13 @@ ShenandoahThreadRoots::~ShenandoahThreadRoots() {
7979}
8080
8181ShenandoahCodeCacheRoots::ShenandoahCodeCacheRoots (ShenandoahPhaseTimings::Phase phase) : _phase(phase) {
82- nmethod::oops_do_marking_prologue ();
8382}
8483
8584void ShenandoahCodeCacheRoots::code_blobs_do (CodeBlobClosure* blob_cl, uint worker_id) {
8685 ShenandoahWorkerTimingsTracker timer (_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
8786 _coderoots_iterator.possibly_parallel_blobs_do (blob_cl);
8887}
8988
90- ShenandoahCodeCacheRoots::~ShenandoahCodeCacheRoots () {
91- nmethod::oops_do_marking_epilogue ();
92- }
93-
9489ShenandoahRootProcessor::ShenandoahRootProcessor (ShenandoahPhaseTimings::Phase phase) :
9590 _heap(ShenandoahHeap::heap()),
9691 _phase(phase),
@@ -250,29 +245,52 @@ void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
250245}
251246
252247ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner (uint n_workers) :
253- ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
254- _thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /* is par*/ ),
255- _vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
256- _cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /* heap iteration*/ ),
257- _weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
258- _code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
259- }
260-
261- void ShenandoahHeapIterationRootScanner::roots_do (OopClosure* oops) {
262- // Must use _claim_other to avoid interfering with concurrent CLDG iteration
263- CLDToOopClosure clds (oops, ClassLoaderData::_claim_other);
264- MarkingCodeBlobClosure code (oops, !CodeBlobToOopClosure::FixRelocations);
265- ShenandoahParallelOopsDoThreadClosure tc_cl (oops, &code, NULL );
266- AlwaysTrueClosure always_true;
267-
268- ResourceMark rm;
269-
270- // Process light-weight/limited parallel roots then
271- _vm_roots.oops_do (oops, 0 );
272- _weak_roots.oops_do <OopClosure>(oops, 0 );
273- _cld_roots.cld_do (&clds, 0 );
274-
275- // Process heavy-weight/fully parallel roots the last
276- _code_roots.code_blobs_do (&code, 0 );
277- _thread_roots.threads_do (&tc_cl, 0 );
278- }
248+ ShenandoahRootProcessor(ShenandoahPhaseTimings::heap_iteration_roots),
249+ _thread_roots(ShenandoahPhaseTimings::heap_iteration_roots, false /* is par*/ ),
250+ _vm_roots(ShenandoahPhaseTimings::heap_iteration_roots),
251+ _cld_roots(ShenandoahPhaseTimings::heap_iteration_roots, n_workers, true /* heap iteration*/ ),
252+ _weak_roots(ShenandoahPhaseTimings::heap_iteration_roots),
253+ _code_roots(ShenandoahPhaseTimings::heap_iteration_roots) {
254+ }
255+
256+ class ShenandoahMarkCodeBlobClosure : public CodeBlobClosure {
257+ private:
258+ OopClosure* const _oops;
259+ BarrierSetNMethod* const _bs_nm;
260+
261+ public:
262+ ShenandoahMarkCodeBlobClosure (OopClosure* oops) :
263+ _oops (oops),
264+ _bs_nm (BarrierSet::barrier_set()->barrier_set_nmethod ()) {}
265+
266+ virtual void do_code_blob (CodeBlob* cb) {
267+ nmethod* const nm = cb->as_nmethod_or_null ();
268+ if (nm != nullptr ) {
269+ if (_bs_nm != nullptr ) {
270+ // Make sure it only sees to-space objects
271+ _bs_nm->nmethod_entry_barrier (nm);
272+ }
273+ ShenandoahNMethod* const snm = ShenandoahNMethod::gc_data (nm);
274+ assert (snm != nullptr , " Sanity" );
275+ snm->oops_do (_oops, false /* fix_relocations*/ );
276+ }
277+ }
278+ };
279+
280+ void ShenandoahHeapIterationRootScanner::roots_do (OopClosure* oops) {
281+ // Must use _claim_other to avoid interfering with concurrent CLDG iteration
282+ CLDToOopClosure clds (oops, ClassLoaderData::_claim_other);
283+ ShenandoahMarkCodeBlobClosure code (oops);
284+ ShenandoahParallelOopsDoThreadClosure tc_cl (oops, &code, NULL );
285+
286+ ResourceMark rm;
287+
288+ // Process light-weight/limited parallel roots then
289+ _vm_roots.oops_do (oops, 0 );
290+ _weak_roots.oops_do <OopClosure>(oops, 0 );
291+ _cld_roots.cld_do (&clds, 0 );
292+
293+ // Process heavy-weight/fully parallel roots the last
294+ _code_roots.code_blobs_do (&code, 0 );
295+ _thread_roots.threads_do (&tc_cl, 0 );
296+ }
0 commit comments