< prev index next >

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

Print this page
rev 56784 : [mq]: tschatzl_review

@@ -70,12 +70,17 @@
     // Failure to force the next GC pause to be an initial mark indicates
     // there is already a concurrent marking cycle in progress.  Set flag
     // to notify the caller and return immediately.
     _cycle_already_in_progress = true;
   } else if (!g1h->do_collection_pause_at_safepoint(_target_pause_time_ms)) {
+    // Failure to perform the collection at all occurs because GCLocker is
+    // active, and we have the bad luck to be the collection request that
+    // makes a later _gc_locker collection needed.  (Else we would have hit
+    // the GCLocker check in the prologue.)
     _transient_failure = true;
   } else if (g1h->should_upgrade_to_full_gc(_gc_cause)) {
+    // GC ran, but we're still in trouble and need a full GC.
     log_info(gc, ergo)("Attempting maximally compacting collection");
     _gc_succeeded = g1h->do_full_collection(false, /* explicit gc */
                                             true /* clear_all_soft_refs */);
     guarantee(_gc_succeeded, "Elevated collections during the safepoint must always succeed");
   } else {

@@ -119,22 +124,18 @@
   if (_gc_succeeded) {
     if (_word_size > 0) {
       // An allocation had been requested. Do it, eventually trying a stronger
       // kind of GC.
       _result = g1h->satisfy_failed_allocation(_word_size, &_gc_succeeded);
-    } else {
-      bool should_upgrade_to_full = g1h->should_upgrade_to_full_gc(_gc_cause);
-
-      if (should_upgrade_to_full) {
+    } else if (g1h->should_upgrade_to_full_gc(_gc_cause)) {
         // There has been a request to perform a GC to free some space. We have no
         // information on how much memory has been asked for. In case there are
         // absolutely no regions left to allocate into, do a maximally compacting full GC.
         log_info(gc, ergo)("Attempting maximally compacting collection");
         _gc_succeeded = g1h->do_full_collection(false, /* explicit gc */
                                                    true   /* clear_all_soft_refs */);
       }
-    }
     guarantee(_gc_succeeded, "Elevated collections during the safepoint must always succeed.");
   }
 }
 
 void VM_G1Concurrent::doit() {
< prev index next >