156 MemRegion committed_unique_to_self(int self, MemRegion mr) const; |
156 MemRegion committed_unique_to_self(int self, MemRegion mr) const; |
157 |
157 |
158 // Mapping from address to card marking array entry |
158 // Mapping from address to card marking array entry |
159 jbyte* byte_for(const void* p) const { |
159 jbyte* byte_for(const void* p) const { |
160 assert(_whole_heap.contains(p), |
160 assert(_whole_heap.contains(p), |
161 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of " |
161 err_msg("Attempt to access p = " PTR_FORMAT " out of bounds of " |
162 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", |
162 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", |
163 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); |
163 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); |
164 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; |
164 jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; |
165 assert(result >= _byte_map && result < _byte_map + _byte_map_size, |
165 assert(result >= _byte_map && result < _byte_map + _byte_map_size, |
166 "out of bounds accessor for card marking array"); |
166 "out of bounds accessor for card marking array"); |
167 return result; |
167 return result; |
397 assert(p >= _byte_map && p < _byte_map + _byte_map_size, |
397 assert(p >= _byte_map && p < _byte_map + _byte_map_size, |
398 "out of bounds access to card marking array"); |
398 "out of bounds access to card marking array"); |
399 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); |
399 size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); |
400 HeapWord* result = (HeapWord*) (delta << card_shift); |
400 HeapWord* result = (HeapWord*) (delta << card_shift); |
401 assert(_whole_heap.contains(result), |
401 assert(_whole_heap.contains(result), |
402 err_msg("Returning result = "PTR_FORMAT" out of bounds of " |
402 err_msg("Returning result = " PTR_FORMAT " out of bounds of " |
403 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", |
403 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", |
404 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); |
404 p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); |
405 return result; |
405 return result; |
406 } |
406 } |
407 |
407 |
408 // Mapping from address to card marking array index. |
408 // Mapping from address to card marking array index. |
409 size_t index_for(void* p) { |
409 size_t index_for(void* p) { |
410 assert(_whole_heap.contains(p), |
410 assert(_whole_heap.contains(p), |
411 err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of " |
411 err_msg("Attempt to access p = " PTR_FORMAT " out of bounds of " |
412 " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", |
412 " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")", |
413 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); |
413 p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); |
414 return byte_for(p) - _byte_map; |
414 return byte_for(p) - _byte_map; |
415 } |
415 } |
416 |
416 |
417 const jbyte* byte_for_index(const size_t card_index) const { |
417 const jbyte* byte_for_index(const size_t card_index) const { |