8294569: Remove CardTable::_last_valid_index
Reviewed-by: tschatzl, kbarrett
This commit is contained in:
parent
7c60e6d2d6
commit
81fda1b756
src/hotspot/share/gc
@ -53,7 +53,6 @@ void G1CardTable::initialize(G1RegionToSpaceMapper* mapper) {
|
||||
_byte_map_size = mapper->reserved().byte_size();
|
||||
|
||||
size_t num_cards = cards_required(_whole_heap.word_size());
|
||||
_last_valid_index = num_cards - 1;
|
||||
|
||||
HeapWord* low_bound = _whole_heap.start();
|
||||
HeapWord* high_bound = _whole_heap.end();
|
||||
@ -64,11 +63,11 @@ void G1CardTable::initialize(G1RegionToSpaceMapper* mapper) {
|
||||
_byte_map = (CardValue*) mapper->reserved().start();
|
||||
_byte_map_base = _byte_map - (uintptr_t(low_bound) >> _card_shift);
|
||||
assert(byte_for(low_bound) == &_byte_map[0], "Checking start of map");
|
||||
assert(byte_for(high_bound-1) <= &_byte_map[_last_valid_index], "Checking end of map");
|
||||
assert(byte_for(high_bound-1) <= &_byte_map[last_valid_index()], "Checking end of map");
|
||||
|
||||
log_trace(gc, barrier)("G1CardTable::G1CardTable: ");
|
||||
log_trace(gc, barrier)(" &_byte_map[0]: " PTR_FORMAT " &_byte_map[_last_valid_index]: " PTR_FORMAT,
|
||||
p2i(&_byte_map[0]), p2i(&_byte_map[_last_valid_index]));
|
||||
log_trace(gc, barrier)(" &_byte_map[0]: " PTR_FORMAT " &_byte_map[last_valid_index()]: " PTR_FORMAT,
|
||||
p2i(&_byte_map[0]), p2i(&_byte_map[last_valid_index()]));
|
||||
log_trace(gc, barrier)(" _byte_map_base: " PTR_FORMAT, p2i(_byte_map_base));
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,6 @@ size_t CardTable::compute_byte_map_size(size_t num_bytes) {
|
||||
|
||||
CardTable::CardTable(MemRegion whole_heap) :
|
||||
_whole_heap(whole_heap),
|
||||
_last_valid_index(0),
|
||||
_page_size(os::vm_page_size()),
|
||||
_byte_map_size(0),
|
||||
_byte_map(NULL),
|
||||
@ -90,7 +89,6 @@ CardTable::~CardTable() {
|
||||
|
||||
void CardTable::initialize() {
|
||||
size_t num_cards = cards_required(_whole_heap.word_size());
|
||||
_last_valid_index = num_cards - 1;
|
||||
|
||||
// each card takes 1 byte; + 1 for the guard card
|
||||
size_t num_bytes = num_cards + 1;
|
||||
@ -121,15 +119,15 @@ void CardTable::initialize() {
|
||||
_byte_map = (CardValue*) heap_rs.base();
|
||||
_byte_map_base = _byte_map - (uintptr_t(low_bound) >> _card_shift);
|
||||
assert(byte_for(low_bound) == &_byte_map[0], "Checking start of map");
|
||||
assert(byte_for(high_bound-1) <= &_byte_map[_last_valid_index], "Checking end of map");
|
||||
assert(byte_for(high_bound-1) <= &_byte_map[last_valid_index()], "Checking end of map");
|
||||
|
||||
CardValue* guard_card = &_byte_map[num_cards];
|
||||
assert(is_aligned(guard_card, _page_size), "must be on its own OS page");
|
||||
_guard_region = MemRegion((HeapWord*)guard_card, _page_size);
|
||||
|
||||
log_trace(gc, barrier)("CardTable::CardTable: ");
|
||||
log_trace(gc, barrier)(" &_byte_map[0]: " PTR_FORMAT " &_byte_map[_last_valid_index]: " PTR_FORMAT,
|
||||
p2i(&_byte_map[0]), p2i(&_byte_map[_last_valid_index]));
|
||||
log_trace(gc, barrier)(" &_byte_map[0]: " PTR_FORMAT " &_byte_map[last_valid_index()]: " PTR_FORMAT,
|
||||
p2i(&_byte_map[0]), p2i(&_byte_map[last_valid_index()]));
|
||||
log_trace(gc, barrier)(" _byte_map_base: " PTR_FORMAT, p2i(_byte_map_base));
|
||||
}
|
||||
|
||||
@ -295,7 +293,7 @@ void CardTable::resize_covered_region(MemRegion new_region) {
|
||||
} else {
|
||||
entry = byte_after(old_region.last());
|
||||
}
|
||||
assert(index_for(new_region.last()) <= _last_valid_index,
|
||||
assert(index_for(new_region.last()) <= last_valid_index(),
|
||||
"The guard card will be overwritten");
|
||||
// This line commented out cleans the newly expanded region and
|
||||
// not the aligned up expanded region.
|
||||
|
@ -44,7 +44,6 @@ protected:
|
||||
// The declaration order of these const fields is important; see the
|
||||
// constructor before changing.
|
||||
const MemRegion _whole_heap; // the region covered by the card table
|
||||
size_t _last_valid_index; // index of the last valid element
|
||||
const size_t _page_size; // page size used when mapping _byte_map
|
||||
size_t _byte_map_size; // in bytes
|
||||
CardValue* _byte_map; // the card marking array
|
||||
@ -107,6 +106,9 @@ protected:
|
||||
static uint _card_size;
|
||||
static uint _card_size_in_words;
|
||||
|
||||
size_t last_valid_index() const {
|
||||
return cards_required(_whole_heap.word_size()) - 1;
|
||||
}
|
||||
public:
|
||||
CardTable(MemRegion whole_heap);
|
||||
virtual ~CardTable();
|
||||
@ -127,7 +129,7 @@ public:
|
||||
|
||||
// Initialization utilities; covered_words is the size of the covered region
|
||||
// in, um, words.
|
||||
inline size_t cards_required(size_t covered_words) {
|
||||
inline size_t cards_required(size_t covered_words) const {
|
||||
assert(is_aligned(covered_words, _card_size_in_words), "precondition");
|
||||
return covered_words / _card_size_in_words;
|
||||
}
|
||||
|
@ -88,7 +88,6 @@
|
||||
nonstatic_field(BarrierSet::FakeRtti, _concrete_tag, BarrierSet::Name) \
|
||||
\
|
||||
nonstatic_field(CardTable, _whole_heap, const MemRegion) \
|
||||
nonstatic_field(CardTable, _last_valid_index, const size_t) \
|
||||
nonstatic_field(CardTable, _page_size, const size_t) \
|
||||
nonstatic_field(CardTable, _byte_map_size, const size_t) \
|
||||
nonstatic_field(CardTable, _byte_map, CardTable::CardValue*) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user