Merge
authortschatzl
Tue, 10 Nov 2015 17:57:01 +0100
changeset 33804 88172a238697
parent 33798 7a020b39663e (diff)
parent 33803 d61d5830df80 (current diff)
child 33805 1cd84a30748c
Merge
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Tue Nov 10 09:29:40 2015 +0100
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Tue Nov 10 17:57:01 2015 +0100
@@ -7348,6 +7348,14 @@
 
   set_freeFinger(freeFinger);
   set_freeRangeInFreeLists(freeRangeInFreeLists);
+  if (CMSTestInFreeList) {
+    if (freeRangeInFreeLists) {
+      FreeChunk* fc = (FreeChunk*) freeFinger;
+      assert(fc->is_free(), "A chunk on the free list should be free.");
+      assert(fc->size() > 0, "Free range should have a size");
+      assert(_sp->verify_chunk_in_free_list(fc), "Chunk is not in free lists");
+    }
+  }
 }
 
 // Note that the sweeper runs concurrently with mutators. Thus,
@@ -7500,7 +7508,12 @@
 
 void SweepClosure::do_already_free_chunk(FreeChunk* fc) {
   const size_t size = fc->size();
-
+  // Chunks that cannot be coalesced are not in the
+  // free lists.
+  if (CMSTestInFreeList && !fc->cantCoalesce()) {
+    assert(_sp->verify_chunk_in_free_list(fc),
+           "free chunk should be in free lists");
+  }
   // a chunk that is already free, should not have been
   // marked in the bit map
   HeapWord* const addr = (HeapWord*) fc;
@@ -7607,6 +7620,9 @@
   // of the adaptive free list allocator.
   const bool fcInFreeLists = fc->is_free();
   assert((HeapWord*)fc <= _limit, "sweep invariant");
+  if (CMSTestInFreeList && fcInFreeLists) {
+    assert(_sp->verify_chunk_in_free_list(fc), "free chunk is not in free lists");
+  }
 
   if (CMSTraceSweeper) {
     gclog_or_tty->print_cr("  -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(fc), chunkSize);
@@ -7658,7 +7674,11 @@
     if (freeRangeInFreeLists()) {
       FreeChunk* const ffc = (FreeChunk*)freeFinger();
       assert(ffc->size() == pointer_delta(fc_addr, freeFinger()),
-        "Size of free range is inconsistent with chunk size.");
+             "Size of free range is inconsistent with chunk size.");
+      if (CMSTestInFreeList) {
+        assert(_sp->verify_chunk_in_free_list(ffc),
+               "Chunk is not in free lists");
+      }
       _sp->coalDeath(ffc->size());
       _sp->removeFreeChunkFromFreeLists(ffc);
       set_freeRangeInFreeLists(false);
@@ -7727,6 +7747,12 @@
   assert(size > 0,
     "A zero sized chunk cannot be added to the free lists.");
   if (!freeRangeInFreeLists()) {
+    if (CMSTestInFreeList) {
+      FreeChunk* fc = (FreeChunk*) chunk;
+      fc->set_size(size);
+      assert(!_sp->verify_chunk_in_free_list(fc),
+             "chunk should not be in free lists yet");
+    }
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists",
                     p2i(chunk), size);
--- a/hotspot/src/share/vm/gc/g1/g1_globals.hpp	Tue Nov 10 09:29:40 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1_globals.hpp	Tue Nov 10 17:57:01 2015 +0100
@@ -48,9 +48,6 @@
   develop(bool, G1TraceMarkStackOverflow, false,                            \
           "If true, extra debugging code for CM restart for ovflw.")        \
                                                                             \
-  develop(bool, G1TraceHeapRegionRememberedSet, false,                      \
-          "Enables heap region remembered set debug logs")                  \
-                                                                            \
   diagnostic(bool, G1SummarizeConcMark, false,                              \
           "Summarize concurrent mark info")                                 \
                                                                             \
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Tue Nov 10 09:29:40 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Tue Nov 10 17:57:01 2015 +0100
@@ -89,14 +89,6 @@
     // Must make this robust in case "from" is not in "_hr", because of
     // concurrency.
 
-    if (G1TraceHeapRegionRememberedSet) {
-      gclog_or_tty->print_cr("    PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
-                             p2i(from),
-                             UseCompressedOops
-                             ? p2i(oopDesc::load_decode_heap_oop((narrowOop*)from))
-                             : p2i(oopDesc::load_decode_heap_oop((oop*)from)));
-    }
-
     HeapRegion* loc_hr = hr();
     // If the test below fails, then this table was reused concurrently
     // with this operation.  This is OK, since the old table was coarsened,
@@ -408,26 +400,9 @@
 void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
   uint cur_hrm_ind = _hr->hrm_index();
 
-  if (G1TraceHeapRegionRememberedSet) {
-    gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
-                                                    p2i(from),
-                                                    UseCompressedOops
-                                                    ? p2i(oopDesc::load_decode_heap_oop((narrowOop*)from))
-                                                    : p2i(oopDesc::load_decode_heap_oop((oop*)from)));
-  }
-
   int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
 
-  if (G1TraceHeapRegionRememberedSet) {
-    gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)",
-                  p2i(_hr->bottom()), from_card,
-                  FromCardCache::at(tid, cur_hrm_ind));
-  }
-
   if (FromCardCache::contains_or_replace(tid, cur_hrm_ind, from_card)) {
-    if (G1TraceHeapRegionRememberedSet) {
-      gclog_or_tty->print_cr("  from-card cache hit.");
-    }
     assert(contains_reference(from), "We just added it!");
     return;
   }
@@ -438,9 +413,6 @@
 
   // If the region is already coarsened, return.
   if (_coarse_map.at(from_hrm_ind)) {
-    if (G1TraceHeapRegionRememberedSet) {
-      gclog_or_tty->print_cr("  coarse map hit.");
-    }
     assert(contains_reference(from), "We just added it!");
     return;
   }
@@ -462,17 +434,8 @@
              "Must be in range.");
       if (G1HRRSUseSparseTable &&
           _sparse_table.add_card(from_hrm_ind, card_index)) {
-        if (G1TraceHeapRegionRememberedSet) {
-          gclog_or_tty->print_cr("   added card to sparse table.");
-        }
         assert(contains_reference_locked(from), "We just added it!");
         return;
-      } else {
-        if (G1TraceHeapRegionRememberedSet) {
-          gclog_or_tty->print_cr("   [tid %u] sparse table entry "
-                        "overflow(f: %d, t: %u)",
-                        tid, from_hrm_ind, cur_hrm_ind);
-        }
       }
 
       if (_n_fine_entries == _max_fine_entries) {
@@ -585,13 +548,6 @@
   if (!_coarse_map.at(max_hrm_index)) {
     _coarse_map.at_put(max_hrm_index, true);
     _n_coarse_entries++;
-    if (G1TraceHeapRegionRememberedSet) {
-      gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
-                 "for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n",
-                 p2i(_hr->bottom()),
-                 p2i(max->hr()->bottom()),
-                 _n_coarse_entries);
-    }
   }
 
   // Unsplice.
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue Nov 10 09:29:40 2015 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Tue Nov 10 17:57:01 2015 +0100
@@ -2077,6 +2077,10 @@
           "unloading of classes when class unloading is enabled")           \
           range(0, 100)                                                     \
                                                                             \
+  develop(bool, CMSTestInFreeList, false,                                   \
+          "Check if the coalesced range is already in the "                 \
+          "free lists as claimed")                                          \
+                                                                            \
   notproduct(bool, CMSVerifyReturnedBytes, false,                           \
           "Check that all the garbage collected was returned to the "       \
           "free lists")                                                     \