src/share/vm/memory/blockOffsetTable.hpp

changeset 1873
3bfae429e2cf
parent 1279
bd02caa94611
child 1907
c18cbe5936b8
equal deleted inserted replaced
1845:f03d0a26bf83 1873:3bfae429e2cf
138 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { 138 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) {
139 assert(index_for(right - 1) < _vs.committed_size(), 139 assert(index_for(right - 1) < _vs.committed_size(),
140 "right address out of range"); 140 "right address out of range");
141 assert(left < right, "Heap addresses out of order"); 141 assert(left < right, "Heap addresses out of order");
142 size_t num_cards = pointer_delta(right, left) >> LogN_words; 142 size_t num_cards = pointer_delta(right, left) >> LogN_words;
143 memset(&_offset_array[index_for(left)], offset, num_cards); 143
144 // Below, we may use an explicit loop instead of memset()
145 // because on certain platforms memset() can give concurrent
146 // readers "out-of-thin-air," phantom zeros; see 6948537.
147 if (UseMemSetInBOT) {
148 memset(&_offset_array[index_for(left)], offset, num_cards);
149 } else {
150 size_t i = index_for(left);
151 const size_t end = i + num_cards;
152 for (; i < end; i++) {
153 _offset_array[i] = offset;
154 }
155 }
144 } 156 }
145 157
146 void set_offset_array(size_t left, size_t right, u_char offset) { 158 void set_offset_array(size_t left, size_t right, u_char offset) {
147 assert(right < _vs.committed_size(), "right address out of range"); 159 assert(right < _vs.committed_size(), "right address out of range");
148 assert(left <= right, "indexes out of order"); 160 assert(left <= right, "indexes out of order");
149 size_t num_cards = right - left + 1; 161 size_t num_cards = right - left + 1;
150 memset(&_offset_array[left], offset, num_cards); 162
163 // Below, we may use an explicit loop instead of memset
164 // because on certain platforms memset() can give concurrent
165 // readers "out-of-thin-air," phantom zeros; see 6948537.
166 if (UseMemSetInBOT) {
167 memset(&_offset_array[left], offset, num_cards);
168 } else {
169 size_t i = left;
170 const size_t end = i + num_cards;
171 for (; i < end; i++) {
172 _offset_array[i] = offset;
173 }
174 }
151 } 175 }
152 176
153 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { 177 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {
154 assert(index < _vs.committed_size(), "index out of range"); 178 assert(index < _vs.committed_size(), "index out of range");
155 assert(high >= low, "addresses out of order"); 179 assert(high >= low, "addresses out of order");

mercurial