提交 3dda40c0 编写于 作者: T tschatzl

8059758: Footprint regressions with JDK-8038423

Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything.
Reviewed-by: jwilhelm, brutisso
上级 ccc48d0f
......@@ -130,7 +130,10 @@ void CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) {
storage->set_mapping_changed_listener(&_listener);
}
void CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions) {
void CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_regions, bool zero_filled) {
if (zero_filled) {
return;
}
// We need to clear the bitmap on commit, removing any existing information.
MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_region), num_regions * HeapRegion::GrainWords);
_bm->clearRange(mr);
......
......@@ -127,7 +127,7 @@ class CMBitMapMappingChangedListener : public G1MappingChangedListener {
void set_bitmap(CMBitMap* bm) { _bm = bm; }
virtual void on_commit(uint start_idx, size_t num_regions);
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
class CMBitMap : public CMBitMapRO {
......
......@@ -109,7 +109,7 @@ public:
class G1BlockOffsetSharedArrayMappingChangedListener : public G1MappingChangedListener {
public:
virtual void on_commit(uint start_idx, size_t num_regions) {
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
// Nothing to do. The BOT is hard-wired to be part of the HeapRegion, and we cannot
// retrieve it here since this would cause firing of several asserts. The code
// executed after commit of a region already needs to do some re-initialization of
......
......@@ -33,7 +33,10 @@
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions) {
void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
if (zero_filled) {
return;
}
MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords);
_counts->clear_range(mr);
}
......
......@@ -42,7 +42,7 @@ class G1CardCountsMappingChangedListener : public G1MappingChangedListener {
public:
void set_cardcounts(G1CardCounts* counts) { _counts = counts; }
virtual void on_commit(uint start_idx, size_t num_regions);
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
// Table to track the number of times a card has been refined. Once
......
......@@ -385,7 +385,9 @@ void G1RegionMappingChangedListener::reset_from_card_cache(uint start_idx, size_
OtherRegionsTable::invalidate(start_idx, num_regions);
}
void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_regions) {
void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
// The from card cache is not the memory that is actually committed. So we cannot
// take advantage of the zero_filled parameter.
reset_from_card_cache(start_idx, num_regions);
}
......
......@@ -172,7 +172,7 @@ class G1RegionMappingChangedListener : public G1MappingChangedListener {
private:
void reset_from_card_cache(uint start_idx, size_t num_regions);
public:
virtual void on_commit(uint start_idx, size_t num_regions);
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
class G1CollectedHeap : public SharedHeap {
......
......@@ -69,7 +69,7 @@ class G1RegionsLargerThanCommitSizeMapper : public G1RegionToSpaceMapper {
virtual void commit_regions(uintptr_t start_idx, size_t num_regions) {
_storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region);
_commit_map.set_range(start_idx, start_idx + num_regions);
fire_on_commit(start_idx, num_regions);
fire_on_commit(start_idx, num_regions, true);
}
virtual void uncommit_regions(uintptr_t start_idx, size_t num_regions) {
......@@ -115,12 +115,14 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
assert(!_commit_map.at(i), err_msg("Trying to commit storage at region "INTPTR_FORMAT" that is already committed", i));
uintptr_t idx = region_idx_to_page_idx(i);
uint old_refcount = _refcounts.get_by_index(idx);
bool zero_filled = false;
if (old_refcount == 0) {
_storage.commit(idx, 1);
zero_filled = true;
}
_refcounts.set_by_index(idx, old_refcount + 1);
_commit_map.set_bit(i);
fire_on_commit(i, 1);
fire_on_commit(i, 1, zero_filled);
}
}
......@@ -139,9 +141,9 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
}
};
void G1RegionToSpaceMapper::fire_on_commit(uint start_idx, size_t num_regions) {
void G1RegionToSpaceMapper::fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
if (_listener != NULL) {
_listener->on_commit(start_idx, num_regions);
_listener->on_commit(start_idx, num_regions, zero_filled);
}
}
......
......@@ -33,7 +33,9 @@ class G1MappingChangedListener VALUE_OBJ_CLASS_SPEC {
public:
// Fired after commit of the memory, i.e. the memory this listener is registered
// for can be accessed.
virtual void on_commit(uint start_idx, size_t num_regions) = 0;
// Zero_filled indicates that the memory can be considered as filled with zero bytes
// when called.
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled) = 0;
};
// Maps region based commit/uncommit requests to the underlying page sized virtual
......@@ -51,7 +53,7 @@ class G1RegionToSpaceMapper : public CHeapObj<mtGC> {
G1RegionToSpaceMapper(ReservedSpace rs, size_t commit_granularity, size_t region_granularity, MemoryType type);
void fire_on_commit(uint start_idx, size_t num_regions);
void fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled);
public:
MemRegion reserved() { return _storage.reserved(); }
......
......@@ -124,7 +124,8 @@ void G1SATBCardTableModRefBS::verify_g1_young_region(MemRegion mr) {
}
#endif
void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, size_t num_regions) {
void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
// Default value for a clean card on the card table is -1. So we cannot take advantage of the zero_filled parameter.
MemRegion mr(G1CollectedHeap::heap()->bottom_addr_for_region(start_idx), num_regions * HeapRegion::GrainWords);
_card_table->clear(mr);
}
......
......@@ -136,7 +136,7 @@ class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedLis
void set_card_table(G1SATBCardTableLoggingModRefBS* card_table) { _card_table = card_table; }
virtual void on_commit(uint start_idx, size_t num_regions);
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
// Adds card-table logging to the post-barrier.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册