< prev index next >

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

Print this page

103     return;
104   }
105 
106   // The range includes at least one full word.
107   clear_range_within_word(beg, bit_index(beg_full_word));
108   clear_large_range_of_words(beg_full_word, end_full_word);
109   clear_range_within_word(bit_index(end_full_word), end);
110 }
111 
112 void ShenandoahMarkBitMap::clear_range_large(MemRegion mr) {
113   MemRegion intersection = mr.intersection(_covered);
114   assert(!intersection.is_empty(),
115          "Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
116           p2i(mr.start()), p2i(mr.end()));
117   // convert address range into offset range
118   size_t beg = address_to_index(intersection.start());
119   size_t end = address_to_index(intersection.end());
120   clear_large_range(beg, end);
121 }
122 



















123 #ifdef ASSERT
124 void ShenandoahMarkBitMap::check_mark(HeapWord* addr) const {
125   assert(ShenandoahHeap::heap()->is_in(addr),
126          "Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
127          p2i(this), p2i(addr));
128 }
129 
130 void ShenandoahMarkBitMap::verify_index(idx_t bit) const {
131   assert(bit < _size,
132          "BitMap index out of bounds: " SIZE_FORMAT " >= " SIZE_FORMAT,
133          bit, _size);
134 }
135 
136 void ShenandoahMarkBitMap::verify_limit(idx_t bit) const {
137   assert(bit <= _size,
138          "BitMap limit out of bounds: " SIZE_FORMAT " > " SIZE_FORMAT,
139          bit, _size);
140 }
141 
142 void ShenandoahMarkBitMap::verify_range(idx_t beg, idx_t end) const {

103     return;
104   }
105 
106   // The range includes at least one full word.
107   clear_range_within_word(beg, bit_index(beg_full_word));
108   clear_large_range_of_words(beg_full_word, end_full_word);
109   clear_range_within_word(bit_index(end_full_word), end);
110 }
111 
112 void ShenandoahMarkBitMap::clear_range_large(MemRegion mr) {
113   MemRegion intersection = mr.intersection(_covered);
114   assert(!intersection.is_empty(),
115          "Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
116           p2i(mr.start()), p2i(mr.end()));
117   // convert address range into offset range
118   size_t beg = address_to_index(intersection.start());
119   size_t end = address_to_index(intersection.end());
120   clear_large_range(beg, end);
121 }
122 
123 size_t ShenandoahMarkBitMap::count_marked(MemRegion mr) const {
124   MemRegion intersection = mr.intersection(_covered);
125   assert(!intersection.is_empty(),
126          "Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
127           p2i(mr.start()), p2i(mr.end()));
128   // convert address range into offset range
129   HeapWord* beg = intersection.start();
130   HeapWord* end = intersection.end();
131   size_t sum = 0;
132   // We could probably be smarter here, but the complication is that we use
133   // two bits per object for strong vs weak marking.
134   for (HeapWord* current = beg; current < end; current++) {
135     if (is_marked(current)) {
136       sum++;
137     }
138   }
139   return sum;
140 }
141 
142 #ifdef ASSERT
143 void ShenandoahMarkBitMap::check_mark(HeapWord* addr) const {
144   assert(ShenandoahHeap::heap()->is_in(addr),
145          "Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
146          p2i(this), p2i(addr));
147 }
148 
149 void ShenandoahMarkBitMap::verify_index(idx_t bit) const {
150   assert(bit < _size,
151          "BitMap index out of bounds: " SIZE_FORMAT " >= " SIZE_FORMAT,
152          bit, _size);
153 }
154 
155 void ShenandoahMarkBitMap::verify_limit(idx_t bit) const {
156   assert(bit <= _size,
157          "BitMap limit out of bounds: " SIZE_FORMAT " > " SIZE_FORMAT,
158          bit, _size);
159 }
160 
161 void ShenandoahMarkBitMap::verify_range(idx_t beg, idx_t end) const {
< prev index next >