79 |
79 |
80 inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const { |
80 inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const { |
81 char* pc = (char*)p; |
81 char* pc = (char*)p; |
82 assert(pc >= (char*)_reserved.start() && |
82 assert(pc >= (char*)_reserved.start() && |
83 pc < (char*)_reserved.end(), |
83 pc < (char*)_reserved.end(), |
84 err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", |
84 "p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", |
85 p2i(p), p2i(_reserved.start()), p2i(_reserved.end()))); |
85 p2i(p), p2i(_reserved.start()), p2i(_reserved.end())); |
86 size_t result = index_for_raw(p); |
86 size_t result = index_for_raw(p); |
87 check_index(result, "bad index from address"); |
87 check_index(result, "bad index from address"); |
88 return result; |
88 return result; |
89 } |
89 } |
90 |
90 |
91 inline HeapWord* |
91 inline HeapWord* |
92 G1BlockOffsetSharedArray::address_for_index(size_t index) const { |
92 G1BlockOffsetSharedArray::address_for_index(size_t index) const { |
93 check_index(index, "index out of range"); |
93 check_index(index, "index out of range"); |
94 HeapWord* result = address_for_index_raw(index); |
94 HeapWord* result = address_for_index_raw(index); |
95 assert(result >= _reserved.start() && result < _reserved.end(), |
95 assert(result >= _reserved.start() && result < _reserved.end(), |
96 err_msg("bad address from index result " PTR_FORMAT |
96 "bad address from index result " PTR_FORMAT |
97 " _reserved.start() " PTR_FORMAT " _reserved.end() " |
97 " _reserved.start() " PTR_FORMAT " _reserved.end() " PTR_FORMAT, |
98 PTR_FORMAT, |
98 p2i(result), p2i(_reserved.start()), p2i(_reserved.end())); |
99 p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); |
|
100 return result; |
99 return result; |
101 } |
100 } |
102 |
101 |
103 inline size_t |
102 inline size_t |
104 G1BlockOffsetArray::block_size(const HeapWord* p) const { |
103 G1BlockOffsetArray::block_size(const HeapWord* p) const { |