< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp

Print this page
@@ -762,11 +762,13 @@
      _generation->prepare_regions_and_collection_set(true /*concurrent*/);
  
      // Has to be done after cset selection
      heap->prepare_concurrent_roots();
  
-     if (!heap->collection_set()->is_empty()) {
+     // ShenandoahGCStateCheckHotpatch: we need full cycle to patch barriers back to idle.
+     // final-roots is pauseless, so there is no way to arm barriers.
+     if (ShenandoahGCStateCheckHotpatch || !heap->collection_set()->is_empty()) {
        LogTarget(Debug, gc, cset) lt;
        if (lt.is_enabled()) {
          ResourceMark rm;
          LogStream ls(lt);
          heap->collection_set()->print_on(&ls);

@@ -1215,10 +1217,15 @@
    }
  
    heap->rebuild_free_set(true /*concurrent*/);
    _generation->heuristics()->start_idle_span();
  
+   if (ShenandoahGCStateCheckHotpatch) {
+     // Final pause: update GC barriers to idle state.
+     ShenandoahCodeRoots::arm_nmethods();
+   }
+ 
    {
      ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::final_update_refs_propagate_gc_state);
      heap->propagate_gc_state_to_all_threads();
    }
  }
< prev index next >