8234000: Make HeapRegion::bottom/end/hrm_index const

Reviewed-by: kbarrett, sjohanss
This commit is contained in:
Thomas Schatzl 2019-11-22 10:03:38 +01:00
parent 3e492436fd
commit 79cfb94d36
4 changed files with 16 additions and 24 deletions

View File

@ -238,8 +238,8 @@ void HeapRegion::clear_humongous() {
HeapRegion::HeapRegion(uint hrm_index,
G1BlockOffsetTable* bot,
MemRegion mr) :
_bottom(NULL),
_end(NULL),
_bottom(mr.start()),
_end(mr.end()),
_top(NULL),
_compaction_top(NULL),
_bot_part(bot, this),
@ -262,19 +262,16 @@ HeapRegion::HeapRegion(uint hrm_index,
_recorded_rs_length(0), _predicted_elapsed_time_ms(0),
_node_index(G1NUMA::UnknownNodeIndex)
{
_rem_set = new HeapRegionRemSet(bot, this);
initialize(mr);
}
void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
assert(_rem_set->is_empty(), "Remembered set must be empty");
assert(Universe::on_page_boundary(mr.start()) && Universe::on_page_boundary(mr.end()),
"invalid space boundaries");
set_bottom(mr.start());
set_end(mr.end());
_rem_set = new HeapRegionRemSet(bot, this);
initialize();
}
void HeapRegion::initialize(bool clear_space, bool mangle_space) {
assert(_rem_set->is_empty(), "Remembered set must be empty");
if (clear_space) {
clear(mangle_space);
}

View File

@ -67,8 +67,8 @@ class nmethod;
class HeapRegion : public CHeapObj<mtGC> {
friend class VMStructs;
HeapWord* _bottom;
HeapWord* _end;
HeapWord* const _bottom;
HeapWord* const _end;
HeapWord* volatile _top;
HeapWord* _compaction_top;
@ -84,10 +84,7 @@ class HeapRegion : public CHeapObj<mtGC> {
HeapWord* _pre_dummy_top;
public:
void set_bottom(HeapWord* value) { _bottom = value; }
HeapWord* bottom() const { return _bottom; }
void set_end(HeapWord* value) { _end = value; }
HeapWord* end() const { return _end; }
void set_compaction_top(HeapWord* compaction_top) { _compaction_top = compaction_top; }
@ -202,7 +199,7 @@ private:
HeapRegionRemSet* _rem_set;
// Cached index of this region in the heap region sequence.
uint _hrm_index;
const uint _hrm_index;
HeapRegionType _type;
@ -301,7 +298,7 @@ public:
// resets the BOT for that heap region.
// The default values for clear_space means that we will do the clearing if
// there's clearing to be done ourselves. We also always mangle the space.
void initialize(MemRegion mr, bool clear_space = false, bool mangle_space = SpaceDecorator::Mangle);
void initialize(bool clear_space = false, bool mangle_space = SpaceDecorator::Mangle);
static int LogOfHRGrainBytes;
static int LogOfHRGrainWords;

View File

@ -217,10 +217,8 @@ void HeapRegionManager::make_regions_available(uint start, uint num_regions, Wor
if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
G1CollectedHeap::heap()->hr_printer()->commit(hr);
}
HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(i);
MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
hr->initialize(mr);
hr->initialize();
hr->set_node_index(G1NUMA::numa()->index_for_region(hr));
insert_into_free_list(at(i));
}

View File

@ -38,9 +38,9 @@
static_field(HeapRegion, LogOfHRGrainBytes, int) \
\
nonstatic_field(HeapRegion, _type, HeapRegionType) \
nonstatic_field(HeapRegion, _bottom, HeapWord*) \
nonstatic_field(HeapRegion, _bottom, HeapWord* const) \
nonstatic_field(HeapRegion, _top, HeapWord* volatile) \
nonstatic_field(HeapRegion, _end, HeapWord*) \
nonstatic_field(HeapRegion, _end, HeapWord* const) \
nonstatic_field(HeapRegion, _compaction_top, HeapWord*) \
\
nonstatic_field(HeapRegionType, _tag, HeapRegionType::Tag volatile) \