172 }
173
174 virtual void invalidate(MemRegion mr);
175 void clear(MemRegion mr);
176 void dirty(MemRegion mr);
177
178 // Provide read-only access to the card table array.
179 const CardValue* byte_for_const(const void* p) const {
180 return byte_for(p);
181 }
182 const CardValue* byte_after_const(const void* p) const {
183 return byte_after(p);
184 }
185
186 // Mapping from card marking array entry to address of first word
187 HeapWord* addr_for(const CardValue* p) const {
188 assert(p >= _byte_map && p < _byte_map + _byte_map_size,
189 "out of bounds access to card marking array. p: " PTR_FORMAT
190 " _byte_map: " PTR_FORMAT " _byte_map + _byte_map_size: " PTR_FORMAT,
191 p2i(p), p2i(_byte_map), p2i(_byte_map + _byte_map_size));
192 size_t delta = pointer_delta(p, _byte_map_base, sizeof(CardValue));
193 HeapWord* result = (HeapWord*) (delta << _card_shift);
194 assert(_whole_heap.contains(result),
195 "Returning result = " PTR_FORMAT " out of bounds of "
196 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
197 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
198 return result;
199 }
200
201 // Mapping from address to card marking array index.
202 size_t index_for(void* p) {
203 assert(_whole_heap.contains(p),
204 "Attempt to access p = " PTR_FORMAT " out of bounds of "
205 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
206 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
207 return byte_for(p) - _byte_map;
208 }
209
210 CardValue* byte_for_index(const size_t card_index) const {
211 return _byte_map + card_index;
212 }
|
172 }
173
174 virtual void invalidate(MemRegion mr);
175 void clear(MemRegion mr);
176 void dirty(MemRegion mr);
177
178 // Provide read-only access to the card table array.
179 const CardValue* byte_for_const(const void* p) const {
180 return byte_for(p);
181 }
182 const CardValue* byte_after_const(const void* p) const {
183 return byte_after(p);
184 }
185
186 // Mapping from card marking array entry to address of first word
187 HeapWord* addr_for(const CardValue* p) const {
188 assert(p >= _byte_map && p < _byte_map + _byte_map_size,
189 "out of bounds access to card marking array. p: " PTR_FORMAT
190 " _byte_map: " PTR_FORMAT " _byte_map + _byte_map_size: " PTR_FORMAT,
191 p2i(p), p2i(_byte_map), p2i(_byte_map + _byte_map_size));
192 size_t delta = (((uintptr_t) p) - ((uintptr_t) _byte_map_base)) / sizeof(CardValue);
193 HeapWord* result = (HeapWord*) (delta << _card_shift);
194 assert(_whole_heap.contains(result),
195 "Returning result = " PTR_FORMAT " out of bounds of "
196 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
197 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
198 return result;
199 }
200
201 // Mapping from address to card marking array index.
202 size_t index_for(void* p) {
203 assert(_whole_heap.contains(p),
204 "Attempt to access p = " PTR_FORMAT " out of bounds of "
205 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
206 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
207 return byte_for(p) - _byte_map;
208 }
209
210 CardValue* byte_for_index(const size_t card_index) const {
211 return _byte_map + card_index;
212 }
|