61 u_char G1BlockOffsetSharedArray::offset_array(size_t index) const { |
61 u_char G1BlockOffsetSharedArray::offset_array(size_t index) const { |
62 check_index(index, "index out of range"); |
62 check_index(index, "index out of range"); |
63 return _offset_array[index]; |
63 return _offset_array[index]; |
64 } |
64 } |
65 |
65 |
|
66 inline void G1BlockOffsetSharedArray::set_offset_array_raw(size_t index, u_char offset) { |
|
67 _offset_array[index] = offset; |
|
68 } |
|
69 |
66 void G1BlockOffsetSharedArray::set_offset_array(size_t index, u_char offset) { |
70 void G1BlockOffsetSharedArray::set_offset_array(size_t index, u_char offset) { |
67 check_index(index, "index out of range"); |
71 check_index(index, "index out of range"); |
68 set_offset_array_raw(index, offset); |
72 set_offset_array_raw(index, offset); |
69 } |
73 } |
70 |
74 |
79 void G1BlockOffsetSharedArray::set_offset_array(size_t left, size_t right, u_char offset) { |
83 void G1BlockOffsetSharedArray::set_offset_array(size_t left, size_t right, u_char offset) { |
80 check_index(right, "right index out of range"); |
84 check_index(right, "right index out of range"); |
81 assert(left <= right, "indexes out of order"); |
85 assert(left <= right, "indexes out of order"); |
82 size_t num_cards = right - left + 1; |
86 size_t num_cards = right - left + 1; |
83 if (UseMemSetInBOT) { |
87 if (UseMemSetInBOT) { |
84 memset(&_offset_array[left], offset, num_cards); |
88 memset(const_cast<u_char*> (&_offset_array[left]), offset, num_cards); |
85 } else { |
89 } else { |
86 size_t i = left; |
90 size_t i = left; |
87 const size_t end = i + num_cards; |
91 const size_t end = i + num_cards; |
88 for (; i < end; i++) { |
92 for (; i < end; i++) { |
89 _offset_array[i] = offset; |
93 _offset_array[i] = offset; |