# HG changeset patch # User Roman Kennke # Date 1423773729 -3600 # Node ID 8a704517c74ea3572247c50af031b131bec675f9 # Parent 2868d01310a4ff37ae1a90bf44e31850d5a822ac Added flag to turn off weakref processing. diff -r 2868d01310a4 -r 8a704517c74e src/share/vm/gc_implementation/shenandoah/shenandoahCollectorPolicy.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahCollectorPolicy.cpp Thu Feb 12 17:33:38 2015 +0100 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahCollectorPolicy.cpp Thu Feb 12 21:42:09 2015 +0100 @@ -501,7 +501,9 @@ print_summary_sd("Drain SATB", 2, &(_timing_data[drain_satb]._ms)); print_summary_sd("Drain Overflow", 2, &(_timing_data[drain_overflow]._ms)); print_summary_sd("Drain Queues", 2, &(_timing_data[drain_queues]._ms)); - print_summary_sd("Weak References", 2, &(_timing_data[weakrefs]._ms)); + if (ShenandoahProcessReferences) { + print_summary_sd("Weak References", 2, &(_timing_data[weakrefs]._ms)); + } print_summary_sd("Prepare Evacuation", 2, &(_timing_data[prepare_evac]._ms)); print_summary_sd("Initial Evacuation", 2, &(_timing_data[init_evac]._ms)); diff -r 2868d01310a4 -r 8a704517c74e src/share/vm/gc_implementation/shenandoah/shenandoahConcurrentMark.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahConcurrentMark.cpp Thu Feb 12 17:33:38 2015 +0100 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahConcurrentMark.cpp Thu Feb 12 21:42:09 2015 +0100 @@ -303,11 +303,11 @@ ShenandoahMarkRootsTask mark_roots(update_refs); heap->workers()->run_task(&mark_roots); heap->set_par_threads(0); // Prepare for serial processing in future calls to process_strong_roots. - - ReferenceProcessor* rp = heap->ref_processor_cm(); - ShenandoahMarkRefsNoUpdateClosure rootsCl2(0); - rp->weak_oops_do(&rootsCl2); - + if (ShenandoahProcessReferences) { + ReferenceProcessor* rp = heap->ref_processor_cm(); + ShenandoahMarkRefsNoUpdateClosure rootsCl2(0); + rp->weak_oops_do(&rootsCl2); + } } else { ExtendedOopClosure* cl; ShenandoahMarkRefsClosure rootsCl1(0); @@ -393,12 +393,12 @@ uint max_workers = full_gc ? _max_worker_id : _max_conc_worker_id; ParallelTaskTerminator terminator(max_workers, _task_queues); - ReferenceProcessor* rp = sh->ref_processor_cm(); - - // enable ("weak") refs discovery - rp->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/); - rp->setup_policy(false); // snapshot the soft ref policy to be used in this cycle - + if (ShenandoahProcessReferences) { + ReferenceProcessor* rp = sh->ref_processor_cm(); + // enable ("weak") refs discovery + rp->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/); + rp->setup_policy(false); // snapshot the soft ref policy to be used in this cycle + } SCMConcurrentMarkingTask markingTask = SCMConcurrentMarkingTask(this, &terminator, update_refs); @@ -503,12 +503,14 @@ #endif // When we're done marking everything, we process weak references. - if (! full_gc) { - sh->shenandoahPolicy()->record_phase_start(ShenandoahCollectorPolicy::weakrefs); - } - weak_refs_work(); - if (! full_gc) { - sh->shenandoahPolicy()->record_phase_end(ShenandoahCollectorPolicy::weakrefs); + if (ShenandoahProcessReferences) { + if (! full_gc) { + sh->shenandoahPolicy()->record_phase_start(ShenandoahCollectorPolicy::weakrefs); + } + weak_refs_work(); + if (! full_gc) { + sh->shenandoahPolicy()->record_phase_end(ShenandoahCollectorPolicy::weakrefs); + } } #ifdef ASSERT diff -r 2868d01310a4 -r 8a704517c74e src/share/vm/gc_implementation/shenandoah/shenandoahHeap.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahHeap.cpp Thu Feb 12 17:33:38 2015 +0100 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahHeap.cpp Thu Feb 12 21:42:09 2015 +0100 @@ -257,7 +257,10 @@ gc_threads_do(&init_gclabs); _scm->initialize(); - ref_processing_init(); + + if (ShenandoahProcessReferences) { + ref_processing_init(); + } } class CalculateUsedRegionClosure : public ShenandoahHeapRegionClosure { @@ -1251,7 +1254,9 @@ ShenandoahHeap* heap = ShenandoahHeap::heap(); ResourceMark rm; heap->process_all_roots(false, SharedHeap::SO_AllCodeCache, &cl, &cldCl, &blobsCl); - heap->ref_processor_cm()->weak_oops_do(&cl); + if (ShenandoahProcessReferences) { + heap->ref_processor_cm()->weak_oops_do(&cl); + } heap->process_weak_roots(&cl); } @@ -1423,7 +1428,9 @@ } void ShenandoahHeap::weak_roots_iterate(ExtendedOopClosure* cl) { - ref_processor_cm()->weak_oops_do(cl); + if (ShenandoahProcessReferences) { + ref_processor_cm()->weak_oops_do(cl); + } process_weak_roots(cl); } diff -r 2868d01310a4 -r 8a704517c74e src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Thu Feb 12 17:33:38 2015 +0100 +++ b/src/share/vm/runtime/globals.hpp Thu Feb 12 21:42:09 2015 +0100 @@ -1443,6 +1443,9 @@ develop(bool, ShenandoahTraceTLabs, false, \ "Trace TLabs in Shenandoah Heap") \ \ + product(bool, ShenandoahProcessReferences, true, \ + "Enable processing of (soft/weak/..) references in Shenandoah") \ + \ develop(bool, ShenandoahTraceWeakReferences, false, \ "Trace Weak Reference Processing in Shenandoah Heap") \ \