src/share/vm/gc_implementation/g1/heapRegionManager.cpp
Print this page
rev 6923 : imported patch 8054819-rename-heapregionseq
@@ -22,17 +22,17 @@
*
*/
#include "precompiled.hpp"
#include "gc_implementation/g1/heapRegion.hpp"
-#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
+#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/concurrentG1Refine.hpp"
#include "memory/allocation.hpp"
-void HeapRegionSeq::initialize(G1RegionToSpaceMapper* heap_storage,
+void HeapRegionManager::initialize(G1RegionToSpaceMapper* heap_storage,
G1RegionToSpaceMapper* prev_bitmap,
G1RegionToSpaceMapper* next_bitmap,
G1RegionToSpaceMapper* bot,
G1RegionToSpaceMapper* cardtable,
G1RegionToSpaceMapper* card_counts) {
@@ -53,28 +53,28 @@
_available_map.resize(_regions.length(), false);
_available_map.clear();
}
-bool HeapRegionSeq::is_available(uint region) const {
+bool HeapRegionManager::is_available(uint region) const {
return _available_map.at(region);
}
#ifdef ASSERT
-bool HeapRegionSeq::is_free(HeapRegion* hr) const {
+bool HeapRegionManager::is_free(HeapRegion* hr) const {
return _free_list.contains(hr);
}
#endif
-HeapRegion* HeapRegionSeq::new_heap_region(uint hrs_index) {
- HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(hrs_index);
+HeapRegion* HeapRegionManager::new_heap_region(uint hrm_index) {
+ HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(hrm_index);
MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
assert(reserved().contains(mr), "invariant");
- return new HeapRegion(hrs_index, G1CollectedHeap::heap()->bot_shared(), mr);
+ return new HeapRegion(hrm_index, G1CollectedHeap::heap()->bot_shared(), mr);
}
-void HeapRegionSeq::commit_regions(uint index, size_t num_regions) {
+void HeapRegionManager::commit_regions(uint index, size_t num_regions) {
guarantee(num_regions > 0, "Must commit more than zero regions");
guarantee(_num_committed + num_regions <= max_length(), "Cannot commit more than the maximum amount of regions");
_num_committed += (uint)num_regions;
@@ -88,11 +88,11 @@
_cardtable_mapper->commit_regions(index, num_regions);
_card_counts_mapper->commit_regions(index, num_regions);
}
-void HeapRegionSeq::uncommit_regions(uint start, size_t num_regions) {
+void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) {
guarantee(num_regions >= 1, err_msg("Need to specify at least one region to uncommit, tried to uncommit zero regions at %u", start));
guarantee(_num_committed >= num_regions, "pre-condition");
// Print before uncommitting.
if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
@@ -115,11 +115,11 @@
_cardtable_mapper->uncommit_regions(start, num_regions);
_card_counts_mapper->uncommit_regions(start, num_regions);
}
-void HeapRegionSeq::make_regions_available(uint start, uint num_regions) {
+void HeapRegionManager::make_regions_available(uint start, uint num_regions) {
guarantee(num_regions > 0, "No point in calling this for zero regions");
commit_regions(start, num_regions);
for (uint i = start; i < start + num_regions; i++) {
if (_regions.get_by_index(i) == NULL) {
HeapRegion* new_hr = new_heap_region(i);
@@ -142,15 +142,15 @@
hr->initialize(mr);
insert_into_free_list(at(i));
}
}
-uint HeapRegionSeq::expand_by(uint num_regions) {
+uint HeapRegionManager::expand_by(uint num_regions) {
return expand_at(0, num_regions);
}
-uint HeapRegionSeq::expand_at(uint start, uint num_regions) {
+uint HeapRegionManager::expand_at(uint start, uint num_regions) {
if (num_regions == 0) {
return 0;
}
uint cur = start;
@@ -169,11 +169,11 @@
verify_optional();
return expanded;
}
-uint HeapRegionSeq::find_contiguous(size_t num, bool empty_only) {
+uint HeapRegionManager::find_contiguous(size_t num, bool empty_only) {
uint found = 0;
size_t length_found = 0;
uint cur = 0;
while (length_found < num && cur < max_length()) {
@@ -197,27 +197,27 @@
err_msg("Found region sequence starting at " UINT32_FORMAT ", length " SIZE_FORMAT
" that is not empty at " UINT32_FORMAT ". Hr is " PTR_FORMAT, found, num, i, p2i(hr)));
}
return found;
} else {
- return G1_NO_HRS_INDEX;
+ return G1_NO_HRM_INDEX;
}
}
-HeapRegion* HeapRegionSeq::next_region_in_heap(const HeapRegion* r) const {
+HeapRegion* HeapRegionManager::next_region_in_heap(const HeapRegion* r) const {
guarantee(r != NULL, "Start region must be a valid region");
- guarantee(is_available(r->hrs_index()), err_msg("Trying to iterate starting from region %u which is not in the heap", r->hrs_index()));
- for (uint i = r->hrs_index() + 1; i < _allocated_heapregions_length; i++) {
+ guarantee(is_available(r->hrm_index()), err_msg("Trying to iterate starting from region %u which is not in the heap", r->hrm_index()));
+ for (uint i = r->hrm_index() + 1; i < _allocated_heapregions_length; i++) {
HeapRegion* hr = _regions.get_by_index(i);
if (is_available(i)) {
return hr;
}
}
return NULL;
}
-void HeapRegionSeq::iterate(HeapRegionClosure* blk) const {
+void HeapRegionManager::iterate(HeapRegionClosure* blk) const {
uint len = max_length();
for (uint i = 0; i < len; i++) {
if (!is_available(i)) {
continue;
@@ -229,11 +229,11 @@
return;
}
}
}
-uint HeapRegionSeq::find_unavailable_from_idx(uint start_idx, uint* res_idx) const {
+uint HeapRegionManager::find_unavailable_from_idx(uint start_idx, uint* res_idx) const {
guarantee(res_idx != NULL, "checking");
guarantee(start_idx <= (max_length() + 1), "checking");
uint num_regions = 0;
@@ -257,15 +257,15 @@
err_msg("The region at the current position %u must be available or at the end of the heap.", cur));
#endif
return num_regions;
}
-uint HeapRegionSeq::start_region_for_worker(uint worker_i, uint num_workers, uint num_regions) const {
+uint HeapRegionManager::start_region_for_worker(uint worker_i, uint num_workers, uint num_regions) const {
return num_regions * worker_i / num_workers;
}
-void HeapRegionSeq::par_iterate(HeapRegionClosure* blk, uint worker_id, uint num_workers, jint claim_value) const {
+void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, uint num_workers, jint claim_value) const {
const uint start_index = start_region_for_worker(worker_id, num_workers, _allocated_heapregions_length);
// Every worker will actually look at all regions, skipping over regions that
// are currently not committed.
// This also (potentially) iterates over regions newly allocated during GC. This
@@ -332,11 +332,11 @@
return;
}
}
}
-uint HeapRegionSeq::shrink_by(uint num_regions_to_remove) {
+uint HeapRegionManager::shrink_by(uint num_regions_to_remove) {
assert(length() > 0, "the region sequence should not be empty");
assert(length() <= _allocated_heapregions_length, "invariant");
assert(_allocated_heapregions_length > 0, "we should have at least one region committed");
assert(num_regions_to_remove < length(), "We should never remove all regions");
@@ -366,11 +366,11 @@
verify_optional();
return removed;
}
-uint HeapRegionSeq::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const {
+uint HeapRegionManager::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const {
guarantee(start_idx < _allocated_heapregions_length, "checking");
guarantee(res_idx != NULL, "checking");
uint num_regions_found = 0;
@@ -395,11 +395,11 @@
}
#endif
return num_regions_found;
}
-void HeapRegionSeq::verify() {
+void HeapRegionManager::verify() {
guarantee(length() <= _allocated_heapregions_length,
err_msg("invariant: _length: %u _allocated_length: %u",
length(), _allocated_heapregions_length));
guarantee(_allocated_heapregions_length <= max_length(),
err_msg("invariant: _allocated_length: %u _max_length: %u",
@@ -417,12 +417,12 @@
HeapRegion* hr = _regions.get_by_index(i);
guarantee(hr != NULL, err_msg("invariant: i: %u", i));
guarantee(!prev_committed || hr->bottom() == prev_end,
err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT,
i, HR_FORMAT_PARAMS(hr), p2i(prev_end)));
- guarantee(hr->hrs_index() == i,
- err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index()));
+ guarantee(hr->hrm_index() == i,
+ err_msg("invariant: i: %u hrm_index(): %u", i, hr->hrm_index()));
// Asserts will fire if i is >= _length
HeapWord* addr = hr->bottom();
guarantee(addr_to_region(addr) == hr, "sanity");
// We cannot check whether the region is part of a particular set: at the time
// this method may be called, we have only completed allocation of the regions,
@@ -441,10 +441,10 @@
guarantee(num_committed == _num_committed, err_msg("Found %u committed regions, but should be %u", num_committed, _num_committed));
_free_list.verify();
}
#ifndef PRODUCT
-void HeapRegionSeq::verify_optional() {
+void HeapRegionManager::verify_optional() {
verify();
}
#endif // PRODUCT