// Return the HeapWord address corrsponding to the next "0" bit // (inclusive). inline HeapWord* CMSBitMap::getNextUnmarkedWordAddress( HeapWord* start_addr, HeapWord* end_addr) const { assert_locked(); size_t nextOffset = _bm.get_next_zero_offset( heapWordToOffset(start_addr), heapWordToOffset(end_addr)); HeapWord* nextAddr = offsetToHeapWord(nextOffset); assert(nextAddr >= start_addr && nextAddr <= end_addr, "get_next_zero postcondition"); assert((nextAddr == end_addr) || isUnmarked(nextAddr), "get_next_zero postcondition"); return nextAddr; }
inline bool G1CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) { HeapWord* start_addr = MAX2(startWord(), mr.start()); HeapWord* end_addr = MIN2(endWord(), mr.end()); if (end_addr > start_addr) { // Right-open interval [start-offset, end-offset). BitMap::idx_t start_offset = heapWordToOffset(start_addr); BitMap::idx_t end_offset = heapWordToOffset(end_addr); start_offset = _bm.get_next_one_offset(start_offset, end_offset); while (start_offset < end_offset) { if (!cl->do_bit(start_offset)) { return false; } HeapWord* next_addr = MIN2(nextObject(offsetToHeapWord(start_offset)), end_addr); BitMap::idx_t next_offset = heapWordToOffset(next_addr); start_offset = _bm.get_next_one_offset(next_offset, end_offset); } } return true; }
// The argument addr should be the start address of a valid object HeapWord* G1CMBitMapRO::nextObject(HeapWord* addr) { oop obj = (oop) addr; HeapWord* res = addr + obj->size(); assert(offsetToHeapWord(heapWordToOffset(res)) == res, "sanity"); return res; }