index

src/share/vm/memory/collectorPolicy.cpp

Print this page
rev 8024 : imported patch event1
* * *
imported patch event2

@@ -595,11 +595,11 @@
   *gc_overhead_limit_was_exceeded = false;
 
   HeapWord* result = NULL;
 
   // Loop until the allocation is satisfied, or unsatisfied after GC.
-  for (uint try_count = 1, gclocker_stalled_count = 0; /* return or throw */; try_count += 1) {
+  for (uint try_count = 1, gclocker_stalled_count = 0, gc_attempt = 1; /* return or throw */; try_count += 1) {
     HandleMark hm; // Discard any handles allocated in each iteration.
 
     // First allocation attempt is lock-free.
     Generation *young = gch->young_gen();
     assert(young->supports_inline_contig_alloc(),

@@ -669,11 +669,11 @@
 
       // Read the gc count while the heap lock is held.
       gc_count_before = Universe::heap()->total_collections();
     }
 
-    VM_GenCollectForAllocation op(size, is_tlab, gc_count_before);
+    VM_GenCollectForAllocation op(size, is_tlab, gc_count_before, gc_attempt++);
     VMThread::execute(&op);
     if (op.prologue_succeeded()) {
       result = op.result();
       if (op.gc_locked()) {
          assert(result == NULL, "must be NULL if gc_locked() is true");

@@ -814,10 +814,11 @@
                                                  size_t word_size,
                                                  Metaspace::MetadataType mdtype) {
   uint loop_count = 0;
   uint gc_count = 0;
   uint full_gc_count = 0;
+  uint gc_attempt = 1;
 
   assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock");
 
   do {
     MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);

@@ -863,11 +864,12 @@
     VM_CollectForMetadataAllocation op(loader_data,
                                        word_size,
                                        mdtype,
                                        gc_count,
                                        full_gc_count,
-                                       GCCause::_metadata_GC_threshold);
+                                       GCCause::_metadata_GC_threshold,
+                                       gc_attempt++);
     VMThread::execute(&op);
 
     // If GC was locked out, try again. Check before checking success because the
     // prologue could have succeeded and the GC still have been locked out.
     if (op.gc_locked()) {
index