210 // query, by updating entries as we cross them.
211
212 // If the fist object's end q is at the card boundary. Start refining
213 // with the corresponding card (the value of the entry will be basically
214 // set to 0). If the object crosses the boundary -- start from the next card.
215 size_t n_index = _bot->index_for(n);
216 size_t next_index = _bot->index_for(n) + !_bot->is_card_boundary(n);
217 // Calculate a consistent next boundary. If "n" is not at the boundary
218 // already, step to the boundary.
219 HeapWord* next_boundary = _bot->address_for_index(n_index) +
220 (n_index == next_index ? 0 : BOTConstants::N_words);
221 assert(next_boundary <= _bot->_reserved.end(),
222 "next_boundary is beyond the end of the covered region "
223 " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT,
224 p2i(next_boundary), p2i(_bot->_reserved.end()));
225 if (addr >= _space->top()) return _space->top();
226 while (next_boundary < addr) {
227 while (n <= next_boundary) {
228 q = n;
229 oop obj = oop(q);
230 if (obj->klass_or_null() == NULL) return q;
231 n += block_size(q);
232 }
233 assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
234 // [q, n) is the block that crosses the boundary.
235 alloc_block_work(&next_boundary, &next_index, q, n);
236 }
237 return forward_to_block_containing_addr_const(q, n, addr);
238 }
239
240 //
241 // threshold_
242 // | _index_
243 // v v
244 // +-------+-------+-------+-------+-------+
245 // | i-1 | i | i+1 | i+2 | i+3 |
246 // +-------+-------+-------+-------+-------+
247 // ( ^ ]
248 // block-start
249 //
250 void G1BlockOffsetTablePart::alloc_block_work(HeapWord** threshold_, size_t* index_,
|
210 // query, by updating entries as we cross them.
211
212 // If the fist object's end q is at the card boundary. Start refining
213 // with the corresponding card (the value of the entry will be basically
214 // set to 0). If the object crosses the boundary -- start from the next card.
215 size_t n_index = _bot->index_for(n);
216 size_t next_index = _bot->index_for(n) + !_bot->is_card_boundary(n);
217 // Calculate a consistent next boundary. If "n" is not at the boundary
218 // already, step to the boundary.
219 HeapWord* next_boundary = _bot->address_for_index(n_index) +
220 (n_index == next_index ? 0 : BOTConstants::N_words);
221 assert(next_boundary <= _bot->_reserved.end(),
222 "next_boundary is beyond the end of the covered region "
223 " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT,
224 p2i(next_boundary), p2i(_bot->_reserved.end()));
225 if (addr >= _space->top()) return _space->top();
226 while (next_boundary < addr) {
227 while (n <= next_boundary) {
228 q = n;
229 oop obj = oop(q);
230 if (obj->klass_or_null_acquire() == NULL) return q;
231 n += block_size(q);
232 }
233 assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
234 // [q, n) is the block that crosses the boundary.
235 alloc_block_work(&next_boundary, &next_index, q, n);
236 }
237 return forward_to_block_containing_addr_const(q, n, addr);
238 }
239
240 //
241 // threshold_
242 // | _index_
243 // v v
244 // +-------+-------+-------+-------+-------+
245 // | i-1 | i | i+1 | i+2 | i+3 |
246 // +-------+-------+-------+-------+-------+
247 // ( ^ ]
248 // block-start
249 //
250 void G1BlockOffsetTablePart::alloc_block_work(HeapWord** threshold_, size_t* index_,
|