@@ -75,7 +75,6 @@ void G1BlockOffsetTable::check_index(size_t index, const char* msg) const {
7575
7676G1BlockOffsetTablePart::G1BlockOffsetTablePart (G1BlockOffsetTable* array, HeapRegion* hr) :
7777 _next_offset_threshold(NULL ),
78- _next_offset_index(0 ),
7978 DEBUG_ONLY(_object_can_span(false ) COMMA)
8079 _bot(array),
8180 _hr(hr)
@@ -246,7 +245,7 @@ HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr_slow(HeapWord
246245 }
247246 assert (q <= next_boundary && n > next_boundary, " Consequence of loop" );
248247 // [q, n) is the block that crosses the boundary.
249- alloc_block_work (&next_boundary, &next_index, q, n);
248+ alloc_block_work (&next_boundary, q, n);
250249 }
251250 return forward_to_block_containing_addr_const (q, n, addr);
252251}
@@ -261,11 +260,11 @@ HeapWord* G1BlockOffsetTablePart::forward_to_block_containing_addr_slow(HeapWord
261260// ( ^ ]
262261// block-start
263262//
264- void G1BlockOffsetTablePart::alloc_block_work (HeapWord** threshold_, size_t * index_ ,
265- HeapWord* blk_start, HeapWord* blk_end) {
263+ void G1BlockOffsetTablePart::alloc_block_work (HeapWord** threshold_, HeapWord* blk_start ,
264+ HeapWord* blk_end) {
266265 // For efficiency, do copy-in/copy-out.
267266 HeapWord* threshold = *threshold_;
268- size_t index = *index_ ;
267+ size_t index = _bot-> index_for_raw (threshold) ;
269268
270269 assert (blk_start != NULL && blk_end > blk_start,
271270 " phantom block" );
@@ -283,8 +282,8 @@ void G1BlockOffsetTablePart::alloc_block_work(HeapWord** threshold_, size_t* ind
283282 DEBUG_ONLY (size_t orig_index = index;)
284283
285284 // Mark the card that holds the offset into the block. Note
286- // that _next_offset_index and _next_offset_threshold are not
287- // updated until the end of this method.
285+ // that _next_offset_threshold is not updated until the end
286+ // of this method.
288287 _bot->set_offset_array (index, threshold, blk_start);
289288
290289 // We need to now mark the subsequent cards that this blk spans.
@@ -307,9 +306,7 @@ void G1BlockOffsetTablePart::alloc_block_work(HeapWord** threshold_, size_t* ind
307306 threshold = _bot->address_for_index (end_index) + BOTConstants::N_words;
308307 assert (threshold >= blk_end, " Incorrect offset threshold" );
309308
310- // index_ and threshold_ updated here.
311309 *threshold_ = threshold;
312- *index_ = index;
313310
314311#ifdef ASSERT
315312 // The offset can be 0 if the block starts on a boundary. That
@@ -341,7 +338,8 @@ void G1BlockOffsetTablePart::verify() const {
341338 assert (_hr->bottom () < _hr->top (), " Only non-empty regions should be verified." );
342339 size_t start_card = _bot->index_for (_hr->bottom ());
343340 // Do not verify beyond the BOT allocation threshold.
344- size_t end_card = MIN2 (_bot->index_for (_hr->top () - 1 ), _next_offset_index - 1 );
341+ size_t next_offset_index = _bot->index_for_raw (_next_offset_threshold);
342+ size_t end_card = MIN2 (_bot->index_for (_hr->top () - 1 ), next_offset_index - 1 );
345343
346344 for (size_t current_card = start_card; current_card < end_card; current_card++) {
347345 u_char entry = _bot->offset_array (current_card);
@@ -398,15 +396,13 @@ void G1BlockOffsetTablePart::print_on(outputStream* out) {
398396 (uint) _bot->offset_array (i));
399397 }
400398 out->print_cr (" next offset threshold: " PTR_FORMAT, p2i (_next_offset_threshold));
401- out->print_cr (" next offset index: " SIZE_FORMAT, _next_offset_index);
402399}
403400#endif // !PRODUCT
404401
405402HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw () {
406- _next_offset_index = _bot->index_for_raw (_hr->bottom ());
407- _next_offset_index++;
403+ size_t next_offset_index = _bot->index_for_raw (_hr->bottom ()) + 1 ;
408404 _next_offset_threshold =
409- _bot->address_for_index_raw (_next_offset_index );
405+ _bot->address_for_index_raw (next_offset_index );
410406 return _next_offset_threshold;
411407}
412408
@@ -418,10 +414,9 @@ void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
418414}
419415
420416HeapWord* G1BlockOffsetTablePart::initialize_threshold () {
421- _next_offset_index = _bot->index_for (_hr->bottom ());
422- _next_offset_index++;
417+ size_t next_offset_index = _bot->index_for (_hr->bottom ()) + 1 ;
423418 _next_offset_threshold =
424- _bot->address_for_index (_next_offset_index );
419+ _bot->address_for_index (next_offset_index );
425420 return _next_offset_threshold;
426421}
427422
0 commit comments