< prev index next >

src/share/vm/gc/g1/heapRegionRemSet.cpp

Print this page

        

@@ -87,17 +87,15 @@
 
   void add_reference_work(OopOrNarrowOopStar from, bool par) {
     // 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 ").",
+    log_develop(gc, remset)("    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,
     // and adding a bit to the new table is never incorrect.

@@ -406,43 +404,35 @@
 }
 
 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 ").",
+  log_develop(gc, remset)("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)",
+  log_develop(gc, remset)("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.");
-    }
+    log_develop(gc, remset)("  from-card cache hit.");
     assert(contains_reference(from), "We just added it!");
     return;
   }
 
   // Note that this may be a continued H region.
   HeapRegion* from_hr = _g1h->heap_region_containing_raw(from);
   RegionIdx_t from_hrm_ind = (RegionIdx_t) from_hr->hrm_index();
 
   // If the region is already coarsened, return.
   if (_coarse_map.at(from_hrm_ind)) {
-    if (G1TraceHeapRegionRememberedSet) {
-      gclog_or_tty->print_cr("  coarse map hit.");
-    }
+    log_develop(gc, remset)("  coarse map hit.");
     assert(contains_reference(from), "We just added it!");
     return;
   }
 
   // Otherwise find a per-region table to add it to.

@@ -460,22 +450,17 @@
       CardIdx_t card_index = from_card - from_hr_bot_card_index;
       assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion,
              "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.");
-        }
+        log_develop(gc, remset)("   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)",
+        log_develop(gc, remset)("   [tid %u] sparse table entry overflow(f: %d, t: %u)",
                         tid, from_hrm_ind, cur_hrm_ind);
         }
-      }
 
       if (_n_fine_entries == _max_fine_entries) {
         prt = delete_region_table();
         // There is no need to clear the links to the 'all' list here:
         // prt will be reused immediately, i.e. remain in the 'all' list.

@@ -583,17 +568,12 @@
   // Set the corresponding coarse bit.
   size_t max_hrm_index = (size_t) max->hr()->hrm_index();
   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);
-    }
+      log_develop(gc, remset)("Coarsened entry in region [" PTR_FORMAT "...] for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries)",
+                              p2i(_hr->bottom()), p2i(max->hr()->bottom()), _n_coarse_entries);
   }
 
   // Unsplice.
   *max_prev = max->collision_list_next();
   Atomic::inc(&_n_coarsenings);

@@ -602,54 +582,38 @@
 }
 
 void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
                               BitMap* region_bm, BitMap* card_bm) {
   // First eliminated garbage regions from the coarse map.
-  if (G1RSScrubVerbose) {
-    gclog_or_tty->print_cr("Scrubbing region %u:", _hr->hrm_index());
-  }
+  log_develop(gc, remset, scrub)("Scrubbing region %u:", _hr->hrm_index());
 
   assert(_coarse_map.size() == region_bm->size(), "Precondition");
-  if (G1RSScrubVerbose) {
-    gclog_or_tty->print("   Coarse map: before = " SIZE_FORMAT "...",
-                        _n_coarse_entries);
-  }
+  log_develop(gc, remset, scrub)("   Coarse map: before = " SIZE_FORMAT "...", _n_coarse_entries);
   _coarse_map.set_intersection(*region_bm);
   _n_coarse_entries = _coarse_map.count_one_bits();
-  if (G1RSScrubVerbose) {
-    gclog_or_tty->print_cr("   after = " SIZE_FORMAT ".", _n_coarse_entries);
-  }
+  log_develop(gc, remset, scrub)("   after = " SIZE_FORMAT ".", _n_coarse_entries);
 
   // Now do the fine-grained maps.
   for (size_t i = 0; i < _max_fine_entries; i++) {
     PerRegionTable* cur = _fine_grain_regions[i];
     PerRegionTable** prev = &_fine_grain_regions[i];
     while (cur != NULL) {
       PerRegionTable* nxt = cur->collision_list_next();
       // If the entire region is dead, eliminate.
-      if (G1RSScrubVerbose) {
-        gclog_or_tty->print_cr("     For other region %u:",
-                               cur->hr()->hrm_index());
-      }
+      log_develop(gc, remset, scrub)("     For other region %u:", cur->hr()->hrm_index());
       if (!region_bm->at((size_t) cur->hr()->hrm_index())) {
         *prev = nxt;
         cur->set_collision_list_next(NULL);
         _n_fine_entries--;
-        if (G1RSScrubVerbose) {
-          gclog_or_tty->print_cr("          deleted via region map.");
-        }
+        log_develop(gc, remset, scrub)("          deleted via region map.");
         unlink_from_all(cur);
         PerRegionTable::free(cur);
       } else {
         // Do fine-grain elimination.
-        if (G1RSScrubVerbose) {
-          gclog_or_tty->print("          occ: before = %4d.", cur->occupied());
-        }
+        log_develop(gc, remset, scrub)("          occ: before = %4d.", cur->occupied());
         cur->scrub(ctbs, card_bm);
-        if (G1RSScrubVerbose) {
-          gclog_or_tty->print_cr("          after = %4d.", cur->occupied());
-        }
+        log_develop(gc, remset, scrub)("          after = %4d.", cur->occupied());
         // Did that empty the table completely?
         if (cur->occupied() == 0) {
           *prev = nxt;
           cur->set_collision_list_next(NULL);
           _n_fine_entries--;

@@ -841,19 +805,19 @@
   HeapRegionRemSetIterator iter(this);
   size_t card_index;
   while (iter.has_next(card_index)) {
     HeapWord* card_start =
       G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index);
-    gclog_or_tty->print_cr("  Card " PTR_FORMAT, p2i(card_start));
+    tty->print_cr("  Card " PTR_FORMAT, p2i(card_start));
   }
   if (iter.n_yielded() != occupied()) {
-    gclog_or_tty->print_cr("Yielded disagrees with occupied:");
-    gclog_or_tty->print_cr("  " SIZE_FORMAT_W(6) " yielded (" SIZE_FORMAT_W(6)
+    tty->print_cr("Yielded disagrees with occupied:");
+    tty->print_cr("  " SIZE_FORMAT_W(6) " yielded (" SIZE_FORMAT_W(6)
                   " coarse, " SIZE_FORMAT_W(6) " fine).",
                   iter.n_yielded(),
                   iter.n_yielded_coarse(), iter.n_yielded_fine());
-    gclog_or_tty->print_cr("  " SIZE_FORMAT_W(6) " occ     (" SIZE_FORMAT_W(6)
+    tty->print_cr("  " SIZE_FORMAT_W(6) " occ     (" SIZE_FORMAT_W(6)
                            " coarse, " SIZE_FORMAT_W(6) " fine).",
                   occupied(), occ_coarse(), occ_fine());
   }
   guarantee(iter.n_yielded() == occupied(),
             "We should have yielded all the represented cards.");

@@ -1131,11 +1095,11 @@
   size_t sum = 0;
   size_t card_index;
   while (iter.has_next(card_index)) {
     HeapWord* card_start =
       G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index);
-    gclog_or_tty->print_cr("  Card " PTR_FORMAT ".", p2i(card_start));
+    tty->print_cr("  Card " PTR_FORMAT ".", p2i(card_start));
     sum++;
   }
   guarantee(sum == 11 - 3 + 2048, "Failure");
   guarantee(sum == hrrs->occupied(), "Failure");
 }
< prev index next >