8213373: Bulk MarkBitMap clearing methods
authorshade
Thu, 15 Nov 2018 21:05:47 +0100
changeset 52577 5b87d3fc1093
parent 52576 367ca5f32505
child 52578 7dd81e82d083
8213373: Bulk MarkBitMap clearing methods Reviewed-by: rkennke, zgu
src/hotspot/share/gc/shared/markBitMap.cpp
src/hotspot/share/gc/shared/markBitMap.hpp
--- a/src/hotspot/share/gc/shared/markBitMap.cpp	Tue Nov 13 22:08:44 2018 -0800
+++ b/src/hotspot/share/gc/shared/markBitMap.cpp	Thu Nov 15 21:05:47 2018 +0100
@@ -44,14 +44,19 @@
   _bm = BitMapView((BitMap::bm_word_t*) storage.start(), _covered.word_size() >> _shifter);
 }
 
-void MarkBitMap::clear_range(MemRegion mr) {
+void MarkBitMap::do_clear(MemRegion mr, bool large) {
   MemRegion intersection = mr.intersection(_covered);
   assert(!intersection.is_empty(),
          "Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
          p2i(mr.start()), p2i(mr.end()));
   // convert address range into offset range
-  _bm.at_put_range(addr_to_offset(intersection.start()),
-                   addr_to_offset(intersection.end()), false);
+  size_t beg = addr_to_offset(intersection.start());
+  size_t end = addr_to_offset(intersection.end());
+  if (large) {
+    _bm.clear_large_range(beg, end);
+  } else {
+    _bm.clear_range(beg, end);
+  }
 }
 
 #ifdef ASSERT
--- a/src/hotspot/share/gc/shared/markBitMap.hpp	Tue Nov 13 22:08:44 2018 -0800
+++ b/src/hotspot/share/gc/shared/markBitMap.hpp	Thu Nov 15 21:05:47 2018 +0100
@@ -49,6 +49,10 @@
   size_t addr_to_offset(const HeapWord* addr) const {
     return pointer_delta(addr, _covered.start()) >> _shifter;
   }
+
+  // Clear bitmap range
+  void do_clear(MemRegion mr, bool large);
+
 public:
   static size_t compute_size(size_t heap_size);
   // Returns the amount of bytes on the heap between two marks in the bitmap.
@@ -88,7 +92,10 @@
   inline bool par_mark(HeapWord* addr);
   inline bool par_mark(oop obj);
 
-  void clear_range(MemRegion mr);
+  // Clear bitmap.
+  void clear()                         { do_clear(_covered, true); }
+  void clear_range(MemRegion mr)       { do_clear(mr, false);      }
+  void clear_range_large(MemRegion mr) { do_clear(mr, true);       }
 };
 
 #endif // SHARE_VM_GC_SHARED_MARKBITMAP_HPP