src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page
rev 6796 : [mq]: 8052170-fix-crash-with-deferredrsupdate

@@ -5468,15 +5468,24 @@
     timer->record_redirty_logged_cards_processed_cards(worker_id, cl.num_processed());
   }
 };
 
 void G1CollectedHeap::redirty_logged_cards() {
-  guarantee(G1DeferredRSUpdate, "Must only be called when using deferred RS updates.");
-  double redirty_logged_cards_start = os::elapsedTime();
-
   uint n_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
                    _g1h->workers()->active_workers() : 1);
+  if (!G1DeferredRSUpdate) {
+    G1GCPhaseTimes* timer = g1_policy()->phase_times();
+
+    for (uint i = 0; i < n_workers; i++) {
+      timer->record_redirty_logged_cards_time_ms(i, 0.0);
+      timer->record_redirty_logged_cards_processed_cards(i, 0);
+    }
+
+    timer->record_redirty_logged_cards_time_ms(0.0);
+    return;
+  }
+  double redirty_logged_cards_start = os::elapsedTime();
 
   G1RedirtyLoggedCardsTask redirty_task(&dirty_card_queue_set());
   dirty_card_queue_set().reset_for_par_iteration();
   if (use_parallel_gc_threads()) {
     set_par_threads(n_workers);

@@ -6133,13 +6142,12 @@
   // will log these updates (and dirty their associated
   // cards). We need these updates logged to update any
   // RSets.
   enqueue_discovered_references(n_workers);
 
-  if (G1DeferredRSUpdate) {
     redirty_logged_cards();
-  }
+
   COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
 }
 
 void G1CollectedHeap::free_region(HeapRegion* hr,
                                   FreeRegionList* free_list,