< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp

Print this page
*** 41,18 ***
  
  size_t ShenandoahMarkBitMap::mark_distance() {
    return MinObjAlignmentInBytes * BitsPerByte / 2;
  }
  
  HeapWord* ShenandoahMarkBitMap::get_next_marked_addr(const HeapWord* addr,
                                                       const HeapWord* limit) const {
    assert(limit != NULL, "limit must not be NULL");
    // Round addr up to a possible object boundary to be safe.
    size_t const addr_offset = address_to_index(align_up(addr, HeapWordSize << LogMinObjAlignment));
    size_t const limit_offset = address_to_index(limit);
    size_t const nextOffset = get_next_one_offset(addr_offset, limit_offset);
!   return index_to_address(nextOffset);
  }
  
  void ShenandoahMarkBitMap::clear_range_within_word(idx_t beg, idx_t end) {
    // With a valid range (beg <= end), this test ensures that end != 0, as
    // required by inverted_bit_mask_for_range.  Also avoids an unnecessary write.
--- 41,41 ---
  
  size_t ShenandoahMarkBitMap::mark_distance() {
    return MinObjAlignmentInBytes * BitsPerByte / 2;
  }
  
+ bool ShenandoahMarkBitMap::is_bitmap_clear_range(const HeapWord* start, const HeapWord* end) const {
+   // Similar to get_next_marked_addr(), without assertion.
+   // Round addr up to a possible object boundary to be safe.
+   if (start == end) {
+     return true;
+   }
+   size_t const addr_offset = address_to_index(align_up(start, HeapWordSize << LogMinObjAlignment));
+   size_t const limit_offset = address_to_index(end);
+   size_t const next_offset = get_next_one_offset(addr_offset, limit_offset);
+   HeapWord* result = index_to_address(next_offset);
+   return (result == end);
+ }
+ 
+ 
  HeapWord* ShenandoahMarkBitMap::get_next_marked_addr(const HeapWord* addr,
                                                       const HeapWord* limit) const {
+ #ifdef ASSERT
+   ShenandoahHeap* heap = ShenandoahHeap::heap();
+   ShenandoahHeapRegion* r = heap->heap_region_containing(addr);
+   ShenandoahMarkingContext* ctx = heap->marking_context();
+   HeapWord* tams = ctx->top_at_mark_start(r);
    assert(limit != NULL, "limit must not be NULL");
+   assert(limit <= tams, "limit must be less than TAMS");
+ #endif
+ 
    // Round addr up to a possible object boundary to be safe.
    size_t const addr_offset = address_to_index(align_up(addr, HeapWordSize << LogMinObjAlignment));
    size_t const limit_offset = address_to_index(limit);
    size_t const nextOffset = get_next_one_offset(addr_offset, limit_offset);
!   HeapWord* result = index_to_address(nextOffset);
+   return result;
  }
  
  void ShenandoahMarkBitMap::clear_range_within_word(idx_t beg, idx_t end) {
    // With a valid range (beg <= end), this test ensures that end != 0, as
    // required by inverted_bit_mask_for_range.  Also avoids an unnecessary write.
< prev index next >