changeset 6758:46b3b2dd84db

Merge
author jmasa
date Thu, 20 Sep 2012 13:49:27 -0700
parents b2ef234911c9 (diff) e861d44e0c9c (current diff)
children 145ffab733e7
files
diffstat 3 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Sep 20 12:18:23 2012 -0700
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Sep 20 13:49:27 2012 -0700
@@ -1851,9 +1851,7 @@
     if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
       G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose);
       add_to_alloc_buffer_waste(alloc_buf->words_remaining());
-      alloc_buf->flush_stats_and_retire(_g1h->stats_for_purpose(purpose),
-                                        false /* end_of_gc */,
-                                        false /* retain */);
+      alloc_buf->retire(false /* end_of_gc */, false /* retain */);
 
       HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size);
       if (buf == NULL) return NULL; // Let caller handle allocation failure.
--- a/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Thu Sep 20 12:18:23 2012 -0700
+++ b/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Thu Sep 20 13:49:27 2012 -0700
@@ -90,7 +90,14 @@
 void PLABStats::adjust_desired_plab_sz() {
   assert(ResizePLAB, "Not set");
   if (_allocated == 0) {
-    assert(_unused == 0, "Inconsistency in PLAB stats");
+    assert(_unused == 0,
+           err_msg("Inconsistency in PLAB stats: "
+                   "_allocated: "SIZE_FORMAT", "
+                   "_wasted: "SIZE_FORMAT", "
+                   "_unused: "SIZE_FORMAT", "
+                   "_used  : "SIZE_FORMAT,
+                   _allocated, _wasted, _unused, _used));
+
     _allocated = 1;
   }
   double wasted_frac    = (double)_unused/(double)_allocated;
--- a/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Thu Sep 20 12:18:23 2012 -0700
+++ b/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Thu Sep 20 13:49:27 2012 -0700
@@ -52,6 +52,10 @@
   static size_t FillerHeaderSize;
   static size_t AlignmentReserve;
 
+  // Flush the stats supporting ergonomic sizing of PLAB's
+  // Should not be called directly
+  void flush_stats(PLABStats* stats);
+
 public:
   // Initializes the buffer to be empty, but with the given "word_sz".
   // Must get initialized with "set_buf" for an allocation to succeed.
@@ -120,12 +124,22 @@
   }
 
   // Flush the stats supporting ergonomic sizing of PLAB's
-  void flush_stats(PLABStats* stats);
+  // and retire the current buffer.
   void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) {
     // We flush the stats first in order to get a reading of
     // unused space in the last buffer.
     if (ResizePLAB) {
       flush_stats(stats);
+
+      // Since we have flushed the stats we need to clear
+      // the _allocated and _wasted fields. Not doing so
+      // will artifically inflate the values in the stats
+      // to which we add them.
+      // The next time we flush these values, we will add
+      // what we have just flushed in addition to the size
+      // of the buffers allocated between now and then.
+      _allocated = 0;
+      _wasted = 0;
     }
     // Retire the last allocation buffer.
     retire(end_of_gc, retain);