< prev index next >

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

Print this page
@@ -1,8 +1,9 @@
  /*
   * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
   * Copyright (c) 2020, Red Hat, Inc. and/or its affiliates.
+  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -41,13 +42,36 @@
  
  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 != nullptr, "limit must not be null");
+   assert(limit <= r->top(), "limit must be less than top");
+   assert(addr <= tams, "addr 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);
    return index_to_address(nextOffset);
< prev index next >