< prev index next >

src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp

Print this page
rev 56195 : 8225716: G1 GC: Undefined behaviour in G1BlockOffsetTablePart::block_at_or_preceding
Reviewed-by: kbarrett, tschatzl


 374 
 375 #ifndef PRODUCT
 376 void
 377 G1BlockOffsetTablePart::print_on(outputStream* out) {
 378   size_t from_index = _bot->index_for(_space->bottom());
 379   size_t to_index = _bot->index_for(_space->end());
 380   out->print_cr(">> BOT for area [" PTR_FORMAT "," PTR_FORMAT ") "
 381                 "cards [" SIZE_FORMAT "," SIZE_FORMAT ")",
 382                 p2i(_space->bottom()), p2i(_space->end()), from_index, to_index);
 383   for (size_t i = from_index; i < to_index; ++i) {
 384     out->print_cr("  entry " SIZE_FORMAT_W(8) " | " PTR_FORMAT " : %3u",
 385                   i, p2i(_bot->address_for_index(i)),
 386                   (uint) _bot->offset_array(i));
 387   }
 388   out->print_cr("  next offset threshold: " PTR_FORMAT, p2i(_next_offset_threshold));
 389   out->print_cr("  next offset index:     " SIZE_FORMAT, _next_offset_index);
 390 }
 391 #endif // !PRODUCT
 392 
 393 HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() {
 394   assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array),
 395          "just checking");
 396   _next_offset_index = _bot->index_for_raw(_space->bottom());
 397   _next_offset_index++;
 398   _next_offset_threshold =
 399     _bot->address_for_index_raw(_next_offset_index);
 400   return _next_offset_threshold;
 401 }
 402 
 403 void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
 404   assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array),
 405          "just checking");
 406   size_t bottom_index = _bot->index_for_raw(_space->bottom());
 407   assert(_bot->address_for_index_raw(bottom_index) == _space->bottom(),
 408          "Precondition of call");
 409   _bot->set_offset_array_raw(bottom_index, 0);
 410 }
 411 
 412 HeapWord* G1BlockOffsetTablePart::initialize_threshold() {
 413   assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array),
 414          "just checking");
 415   _next_offset_index = _bot->index_for(_space->bottom());
 416   _next_offset_index++;
 417   _next_offset_threshold =
 418     _bot->address_for_index(_next_offset_index);
 419   return _next_offset_threshold;
 420 }
 421 
 422 void G1BlockOffsetTablePart::set_for_starts_humongous(HeapWord* obj_top, size_t fill_size) {
 423   // The first BOT entry should have offset 0.
 424   reset_bot();
 425   alloc_block(_space->bottom(), obj_top);
 426   if (fill_size > 0) {
 427     alloc_block(obj_top, fill_size);
 428   }
 429 }


 374 
 375 #ifndef PRODUCT
 376 void
 377 G1BlockOffsetTablePart::print_on(outputStream* out) {
 378   size_t from_index = _bot->index_for(_space->bottom());
 379   size_t to_index = _bot->index_for(_space->end());
 380   out->print_cr(">> BOT for area [" PTR_FORMAT "," PTR_FORMAT ") "
 381                 "cards [" SIZE_FORMAT "," SIZE_FORMAT ")",
 382                 p2i(_space->bottom()), p2i(_space->end()), from_index, to_index);
 383   for (size_t i = from_index; i < to_index; ++i) {
 384     out->print_cr("  entry " SIZE_FORMAT_W(8) " | " PTR_FORMAT " : %3u",
 385                   i, p2i(_bot->address_for_index(i)),
 386                   (uint) _bot->offset_array(i));
 387   }
 388   out->print_cr("  next offset threshold: " PTR_FORMAT, p2i(_next_offset_threshold));
 389   out->print_cr("  next offset index:     " SIZE_FORMAT, _next_offset_index);
 390 }
 391 #endif // !PRODUCT
 392 
 393 HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() {
 394   assert(!G1CollectedHeap::heap()->is_in_reserved(const_cast<u_char*> (_bot->_offset_array)),
 395          "just checking");
 396   _next_offset_index = _bot->index_for_raw(_space->bottom());
 397   _next_offset_index++;
 398   _next_offset_threshold =
 399     _bot->address_for_index_raw(_next_offset_index);
 400   return _next_offset_threshold;
 401 }
 402 
 403 void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
 404   assert(!G1CollectedHeap::heap()->is_in_reserved(const_cast<u_char*> (_bot->_offset_array)),
 405          "just checking");
 406   size_t bottom_index = _bot->index_for_raw(_space->bottom());
 407   assert(_bot->address_for_index_raw(bottom_index) == _space->bottom(),
 408          "Precondition of call");
 409   _bot->set_offset_array_raw(bottom_index, 0);
 410 }
 411 
 412 HeapWord* G1BlockOffsetTablePart::initialize_threshold() {
 413   assert(!G1CollectedHeap::heap()->is_in_reserved(const_cast<u_char*> (_bot->_offset_array)),
 414          "just checking");
 415   _next_offset_index = _bot->index_for(_space->bottom());
 416   _next_offset_index++;
 417   _next_offset_threshold =
 418     _bot->address_for_index(_next_offset_index);
 419   return _next_offset_threshold;
 420 }
 421 
 422 void G1BlockOffsetTablePart::set_for_starts_humongous(HeapWord* obj_top, size_t fill_size) {
 423   // The first BOT entry should have offset 0.
 424   reset_bot();
 425   alloc_block(_space->bottom(), obj_top);
 426   if (fill_size > 0) {
 427     alloc_block(obj_top, fill_size);
 428   }
 429 }
< prev index next >