提交 ab0c41c5 编写于 作者: T tschatzl

8054819: Rename HeapRegionSeq to HeapRegionManager

Reviewed-by: jwilhelm, jmasa
上级 e11edb65
......@@ -43,8 +43,8 @@ import sun.jvm.hotspot.types.TypeDataBase;
// Mirror class for G1CollectedHeap.
public class G1CollectedHeap extends SharedHeap {
// HeapRegionSeq _seq;
static private long hrsFieldOffset;
// HeapRegionManager _hrm;
static private long hrmFieldOffset;
// MemRegion _g1_reserved;
static private long g1ReservedFieldOffset;
// size_t _summary_bytes_used;
......@@ -67,7 +67,7 @@ public class G1CollectedHeap extends SharedHeap {
static private synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("G1CollectedHeap");
hrsFieldOffset = type.getField("_hrs").getOffset();
hrmFieldOffset = type.getField("_hrm").getOffset();
summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
g1mmField = type.getAddressField("_g1mm");
oldSetFieldOffset = type.getField("_old_set").getOffset();
......@@ -75,7 +75,7 @@ public class G1CollectedHeap extends SharedHeap {
}
public long capacity() {
return hrs().capacity();
return hrm().capacity();
}
public long used() {
......@@ -83,13 +83,13 @@ public class G1CollectedHeap extends SharedHeap {
}
public long n_regions() {
return hrs().length();
return hrm().length();
}
private HeapRegionSeq hrs() {
Address hrsAddr = addr.addOffsetTo(hrsFieldOffset);
return (HeapRegionSeq) VMObjectFactory.newObject(HeapRegionSeq.class,
hrsAddr);
private HeapRegionManager hrm() {
Address hrmAddr = addr.addOffsetTo(hrmFieldOffset);
return (HeapRegionManager) VMObjectFactory.newObject(HeapRegionManager.class,
hrmAddr);
}
public G1MonitoringSupport g1mm() {
......@@ -110,7 +110,7 @@ public class G1CollectedHeap extends SharedHeap {
}
private Iterator<HeapRegion> heapRegionIterator() {
return hrs().heapRegionIterator();
return hrm().heapRegionIterator();
}
public void heapRegionIterate(SpaceClosure scl) {
......
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -37,9 +37,9 @@ import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
// Mirror class for HeapRegionSeq. It essentially encapsulates the G1HeapRegionTable.
// Mirror class for HeapRegionManager.
public class HeapRegionSeq extends VMObject {
public class HeapRegionManager extends VMObject {
// G1HeapRegionTable _regions
static private long regionsFieldOffset;
// uint _committed_length
......@@ -54,7 +54,7 @@ public class HeapRegionSeq extends VMObject {
}
static private synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("HeapRegionSeq");
Type type = db.lookupType("HeapRegionManager");
regionsFieldOffset = type.getField("_regions").getOffset();
numCommittedField = type.getCIntegerField("_num_committed");
......@@ -82,7 +82,7 @@ public class HeapRegionSeq extends VMObject {
return regions().heapRegionIterator(length());
}
public HeapRegionSeq(Address addr) {
public HeapRegionManager(Address addr) {
super(addr);
}
}
......@@ -34,8 +34,8 @@
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.hpp"
#include "gc_implementation/g1/heapRegion.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/shared/vmGCOperations.hpp"
#include "gc_implementation/shared/gcTimer.hpp"
......@@ -1408,7 +1408,7 @@ protected:
void set_bit_for_region(HeapRegion* hr) {
assert(!hr->continuesHumongous(), "should have filtered those out");
BitMap::idx_t index = (BitMap::idx_t) hr->hrs_index();
BitMap::idx_t index = (BitMap::idx_t) hr->hrm_index();
if (!hr->startsHumongous()) {
// Normal (non-humongous) case: just set the bit.
_region_bm->par_at_put(index, true);
......@@ -1596,7 +1596,7 @@ public:
if (_verbose) {
gclog_or_tty->print_cr("Region %u: marked bytes mismatch: "
"expected: " SIZE_FORMAT ", actual: " SIZE_FORMAT,
hr->hrs_index(), exp_marked_bytes, act_marked_bytes);
hr->hrm_index(), exp_marked_bytes, act_marked_bytes);
}
failures += 1;
}
......@@ -1605,7 +1605,7 @@ public:
// (which was just calculated) region bit maps.
// We're not OK if the bit in the calculated expected region
// bitmap is set and the bit in the actual region bitmap is not.
BitMap::idx_t index = (BitMap::idx_t) hr->hrs_index();
BitMap::idx_t index = (BitMap::idx_t) hr->hrm_index();
bool expected = _exp_region_bm->at(index);
bool actual = _region_bm->at(index);
......@@ -1613,7 +1613,7 @@ public:
if (_verbose) {
gclog_or_tty->print_cr("Region %u: region bitmap mismatch: "
"expected: %s, actual: %s",
hr->hrs_index(),
hr->hrm_index(),
BOOL_TO_STR(expected), BOOL_TO_STR(actual));
}
failures += 1;
......@@ -1634,7 +1634,7 @@ public:
if (_verbose) {
gclog_or_tty->print_cr("Region %u: card bitmap mismatch at " SIZE_FORMAT ": "
"expected: %s, actual: %s",
hr->hrs_index(), i,
hr->hrm_index(), i,
BOOL_TO_STR(expected), BOOL_TO_STR(actual));
}
failures += 1;
......@@ -3254,7 +3254,7 @@ class AggregateCountDataHRClosure: public HeapRegionClosure {
assert(limit_idx <= end_idx, "or else use atomics");
// Aggregate the "stripe" in the count data associated with hr.
uint hrs_index = hr->hrs_index();
uint hrm_index = hr->hrm_index();
size_t marked_bytes = 0;
for (uint i = 0; i < _max_worker_id; i += 1) {
......@@ -3263,7 +3263,7 @@ class AggregateCountDataHRClosure: public HeapRegionClosure {
// Fetch the marked_bytes in this region for task i and
// add it to the running total for this region.
marked_bytes += marked_bytes_array[hrs_index];
marked_bytes += marked_bytes_array[hrm_index];
// Now union the bitmaps[0,max_worker_id)[start_idx..limit_idx)
// into the global card bitmap.
......
......@@ -86,7 +86,7 @@ inline void ConcurrentMark::count_region(MemRegion mr, HeapRegion* hr,
HeapWord* start = mr.start();
HeapWord* end = mr.end();
size_t region_size_bytes = mr.byte_size();
uint index = hr->hrs_index();
uint index = hr->hrm_index();
assert(!hr->continuesHumongous(), "should not be HC region");
assert(hr == g1h->heap_region_containing(start), "sanity");
......
......@@ -33,7 +33,7 @@
#include "gc_implementation/g1/g1MonitoringSupport.hpp"
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/g1YCTypes.hpp"
#include "gc_implementation/g1/heapRegionSeq.hpp"
#include "gc_implementation/g1/heapRegionManager.hpp"
#include "gc_implementation/g1/heapRegionSet.hpp"
#include "gc_implementation/shared/hSpaceCounters.hpp"
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
......@@ -291,7 +291,7 @@ private:
G1RegionMappingChangedListener _listener;
// The sequence of all heap regions in the heap.
HeapRegionSeq _hrs;
HeapRegionManager _hrm;
// Alloc region used to satisfy mutator allocation requests.
MutatorAllocRegion _mutator_alloc_region;
......@@ -429,7 +429,7 @@ private:
// If the HR printer is active, dump the state of the regions in the
// heap after a compaction.
void print_hrs_post_compaction();
void print_hrm_post_compaction();
double verify(bool guard, const char* msg);
void verify_before_gc();
......@@ -715,7 +715,7 @@ public:
// We register a region with the fast "in collection set" test. We
// simply set to true the array slot corresponding to this region.
void register_region_with_in_cset_fast_test(HeapRegion* r) {
_in_cset_fast_test.set_in_cset(r->hrs_index());
_in_cset_fast_test.set_in_cset(r->hrm_index());
}
// This is a fast test on whether a reference points into the
......@@ -1171,17 +1171,17 @@ public:
// But G1CollectedHeap doesn't yet support this.
virtual bool is_maximal_no_gc() const {
return _hrs.available() == 0;
return _hrm.available() == 0;
}
// The current number of regions in the heap.
uint num_regions() const { return _hrs.length(); }
uint num_regions() const { return _hrm.length(); }
// The max number of regions in the heap.
uint max_regions() const { return _hrs.max_length(); }
uint max_regions() const { return _hrm.max_length(); }
// The number of regions that are completely free.
uint num_free_regions() const { return _hrs.num_free_regions(); }
uint num_free_regions() const { return _hrm.num_free_regions(); }
// The number of regions that are not completely free.
uint num_used_regions() const { return num_regions() - num_free_regions(); }
......@@ -1233,7 +1233,7 @@ public:
#ifdef ASSERT
bool is_on_master_free_list(HeapRegion* hr) {
return _hrs.is_free(hr);
return _hrm.is_free(hr);
}
#endif // ASSERT
......@@ -1245,7 +1245,7 @@ public:
}
void append_secondary_free_list() {
_hrs.insert_list_into_free_list(&_secondary_free_list);
_hrm.insert_list_into_free_list(&_secondary_free_list);
}
void append_secondary_free_list_if_not_empty_with_lock() {
......@@ -1356,13 +1356,13 @@ public:
// Return "TRUE" iff the given object address is in the reserved
// region of g1.
bool is_in_g1_reserved(const void* p) const {
return _hrs.reserved().contains(p);
return _hrm.reserved().contains(p);
}
// Returns a MemRegion that corresponds to the space that has been
// reserved for the heap
MemRegion g1_reserved() const {
return _hrs.reserved();
return _hrm.reserved();
}
virtual bool is_in_closed_subset(const void* p) const;
......
......@@ -30,15 +30,15 @@
#include "gc_implementation/g1/g1AllocRegion.inline.hpp"
#include "gc_implementation/g1/g1CollectorPolicy.hpp"
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "utilities/taskqueue.hpp"
// Inline functions for G1CollectedHeap
// Return the region with the given index. It assumes the index is valid.
inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrs.at(index); }
inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm.at(index); }
inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
assert(is_in_reserved(addr),
......@@ -48,7 +48,7 @@ inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
}
inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
return _hrs.reserved().start() + index * HeapRegion::GrainWords;
return _hrm.reserved().start() + index * HeapRegion::GrainWords;
}
template <class T>
......@@ -57,7 +57,7 @@ inline HeapRegion* G1CollectedHeap::heap_region_containing_raw(const T addr) con
assert(is_in_g1_reserved((const void*) addr),
err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")",
p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end())));
return _hrs.addr_to_region((HeapWord*) addr);
return _hrm.addr_to_region((HeapWord*) addr);
}
template <class T>
......@@ -87,7 +87,7 @@ inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
}
inline bool G1CollectedHeap::obj_in_cs(oop obj) {
HeapRegion* r = _hrs.addr_to_region((HeapWord*) obj);
HeapRegion* r = _hrm.addr_to_region((HeapWord*) obj);
return r != NULL && r->in_collection_set();
}
......
......@@ -32,7 +32,7 @@
#include "gc_implementation/g1/g1GCPhaseTimes.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
......
......@@ -29,7 +29,7 @@
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/heapRegion.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/shared/liveRange.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "memory/iterator.hpp"
......@@ -344,11 +344,11 @@ HeapWord* HeapRegion::next_block_start_careful(HeapWord* addr) {
return low;
}
HeapRegion::HeapRegion(uint hrs_index,
HeapRegion::HeapRegion(uint hrm_index,
G1BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) :
G1OffsetTableContigSpace(sharedOffsetArray, mr),
_hrs_index(hrs_index),
_hrm_index(hrm_index),
_humongous_type(NotHumongous), _humongous_start_region(NULL),
_in_collection_set(false),
_next_in_special_set(NULL), _orig_end(NULL),
......
......@@ -54,15 +54,15 @@ class nmethod;
#define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
#define HR_FORMAT_PARAMS(_hr_) \
(_hr_)->hrs_index(), \
(_hr_)->hrm_index(), \
(_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \
(_hr_)->startsHumongous() ? "HS" : \
(_hr_)->continuesHumongous() ? "HC" : \
!(_hr_)->is_empty() ? "O" : "F", \
p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
// sentinel value for hrs_index
#define G1_NO_HRS_INDEX ((uint) -1)
// sentinel value for hrm_index
#define G1_NO_HRM_INDEX ((uint) -1)
// A dirty card to oop closure for heap regions. It
// knows how to get the G1 heap and how to use the bitmap
......@@ -234,7 +234,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
protected:
// The index of this region in the heap region sequence.
uint _hrs_index;
uint _hrm_index;
HumongousType _humongous_type;
// For a humongous region, region in which it starts.
......@@ -330,7 +330,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
size_t _predicted_bytes_to_copy;
public:
HeapRegion(uint hrs_index,
HeapRegion(uint hrm_index,
G1BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr);
......@@ -385,9 +385,9 @@ class HeapRegion: public G1OffsetTableContigSpace {
inline HeapWord* par_allocate_no_bot_updates(size_t word_size);
inline HeapWord* allocate_no_bot_updates(size_t word_size);
// If this region is a member of a HeapRegionSeq, the index in that
// If this region is a member of a HeapRegionManager, the index in that
// sequence, otherwise -1.
uint hrs_index() const { return _hrs_index; }
uint hrm_index() const { return _hrm_index; }
// The number of bytes marked live in the region in the last marking phase.
size_t marked_bytes() { return _prev_marked_bytes; }
......@@ -458,7 +458,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
// with this HS region.
uint last_hc_index() const {
assert(startsHumongous(), "don't call this otherwise");
return hrs_index() + region_num();
return hrm_index() + region_num();
}
// Same as Space::is_in_reserved, but will use the original size of the region.
......@@ -813,7 +813,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
// HeapRegionClosure is used for iterating over regions.
// Terminates the iteration when the "doHeapRegion" method returns "true".
class HeapRegionClosure : public StackObj {
friend class HeapRegionSeq;
friend class HeapRegionManager;
friend class G1CollectedHeap;
bool _complete;
......
......@@ -24,13 +24,13 @@
#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,
......@@ -55,24 +55,24 @@ void HeapRegionSeq::initialize(G1RegionToSpaceMapper* heap_storage,
_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");
......@@ -90,7 +90,7 @@ void HeapRegionSeq::commit_regions(uint index, size_t 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");
......@@ -117,7 +117,7 @@ void HeapRegionSeq::uncommit_regions(uint start, size_t 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++) {
......@@ -144,11 +144,11 @@ void HeapRegionSeq::make_regions_available(uint start, uint num_regions) {
}
}
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;
}
......@@ -171,7 +171,7 @@ uint HeapRegionSeq::expand_at(uint start, uint num_regions) {
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;
......@@ -199,14 +199,14 @@ uint HeapRegionSeq::find_contiguous(size_t num, bool empty_only) {
}
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;
......@@ -215,7 +215,7 @@ HeapRegion* HeapRegionSeq::next_region_in_heap(const HeapRegion* r) const {
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++) {
......@@ -231,7 +231,7 @@ void HeapRegionSeq::iterate(HeapRegionClosure* blk) const {
}
}
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");
......@@ -259,11 +259,11 @@ uint HeapRegionSeq::find_unavailable_from_idx(uint start_idx, uint* res_idx) con
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
......@@ -334,7 +334,7 @@ void HeapRegionSeq::par_iterate(HeapRegionClosure* blk, uint worker_id, uint num
}
}
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");
......@@ -368,7 +368,7 @@ uint HeapRegionSeq::shrink_by(uint num_regions_to_remove) {
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");
......@@ -397,7 +397,7 @@ uint HeapRegionSeq::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) c
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));
......@@ -419,8 +419,8 @@ void HeapRegionSeq::verify() {
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");
......@@ -443,7 +443,7 @@ void HeapRegionSeq::verify() {
}
#ifndef PRODUCT
void HeapRegionSeq::verify_optional() {
void HeapRegionManager::verify_optional() {
verify();
}
#endif // PRODUCT
......
......@@ -22,8 +22,8 @@
*
*/
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_HPP
#include "gc_implementation/g1/g1BiasedArray.hpp"
#include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
......@@ -64,7 +64,7 @@ class G1HeapRegionTable : public G1BiasedMappedArray<HeapRegion*> {
// * max_length() returns the maximum number of regions the heap can have.
//
class HeapRegionSeq: public CHeapObj<mtGC> {
class HeapRegionManager: public CHeapObj<mtGC> {
friend class VMStructs;
G1HeapRegionTable _regions;
......@@ -104,7 +104,7 @@ class HeapRegionSeq: public CHeapObj<mtGC> {
uint start_region_for_worker(uint worker_i, uint num_workers, uint num_regions) const;
// Find a contiguous set of empty or uncommitted regions of length num and return
// the index of the first region or G1_NO_HRS_INDEX if the search was unsuccessful.
// the index of the first region or G1_NO_HRM_INDEX if the search was unsuccessful.
// If only_empty is true, only empty regions are considered.
// Searches from bottom to top of the heap, doing a first-fit.
uint find_contiguous(size_t num, bool only_empty);
......@@ -117,7 +117,7 @@ class HeapRegionSeq: public CHeapObj<mtGC> {
// sequence could be found, otherwise res_idx contains the start index of this range.
uint find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const;
// Allocate a new HeapRegion for the given index.
HeapRegion* new_heap_region(uint hrs_index);
HeapRegion* new_heap_region(uint hrm_index);
#ifdef ASSERT
public:
bool is_free(HeapRegion* hr) const;
......@@ -125,9 +125,9 @@ public:
// Returns whether the given region is available for allocation.
bool is_available(uint region) const;
public:
// Empty constructor, we'll initialize it with the initialize() method.
HeapRegionSeq() : _regions(), _heap_mapper(NULL), _num_committed(0),
public:
// Empty constructor, we'll initialize it with the initialize() method.
HeapRegionManager() : _regions(), _heap_mapper(NULL), _num_committed(0),
_next_bitmap_mapper(NULL), _prev_bitmap_mapper(NULL), _bot_mapper(NULL),
_allocated_heapregions_length(0), _available_map(),
_free_list("Free list", new MasterFreeRegionListMtSafeChecker())
......@@ -167,7 +167,7 @@ public:
if (hr != NULL) {
assert(hr->next() == NULL, "Single region should not have next");
assert(is_available(hr->hrs_index()), "Must be committed");
assert(is_available(hr->hrm_index()), "Must be committed");
}
return hr;
}
......@@ -211,10 +211,10 @@ public:
uint expand_at(uint start, uint num_regions);
// Find a contiguous set of empty regions of length num. Returns the start index of
// that set, or G1_NO_HRS_INDEX.
// that set, or G1_NO_HRM_INDEX.
uint find_contiguous_only_empty(size_t num) { return find_contiguous(num, true); }
// Find a contiguous set of empty or unavailable regions of length num. Returns the
// start index of that set, or G1_NO_HRS_INDEX.
// start index of that set, or G1_NO_HRM_INDEX.
uint find_contiguous_empty_or_unavailable(size_t num) { return find_contiguous(num, false); }
HeapRegion* next_region_in_heap(const HeapRegion* r) const;
......@@ -235,4 +235,4 @@ public:
void verify_optional() PRODUCT_RETURN;
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_HPP
......@@ -22,14 +22,14 @@
*
*/
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_INLINE_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_INLINE_HPP
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_INLINE_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_INLINE_HPP
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_implementation/g1/heapRegionSeq.hpp"
#include "gc_implementation/g1/heapRegionManager.hpp"
#include "gc_implementation/g1/heapRegionSet.inline.hpp"
inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
inline HeapRegion* HeapRegionManager::addr_to_region(HeapWord* addr) const {
assert(addr < heap_end(),
err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, p2i(addr), p2i(heap_end())));
assert(addr >= heap_bottom(),
......@@ -39,20 +39,20 @@ inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
return hr;
}
inline HeapRegion* HeapRegionSeq::at(uint index) const {
inline HeapRegion* HeapRegionManager::at(uint index) const {
assert(is_available(index), "pre-condition");
HeapRegion* hr = _regions.get_by_index(index);
assert(hr != NULL, "sanity");
assert(hr->hrs_index() == index, "sanity");
assert(hr->hrm_index() == index, "sanity");
return hr;
}
inline void HeapRegionSeq::insert_into_free_list(HeapRegion* hr) {
inline void HeapRegionManager::insert_into_free_list(HeapRegion* hr) {
_free_list.add_ordered(hr);
}
inline void HeapRegionSeq::allocate_free_regions_starting_at(uint first, uint num_regions) {
inline void HeapRegionManager::allocate_free_regions_starting_at(uint first, uint num_regions) {
_free_list.remove_starting_at(at(first), num_regions);
}
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_INLINE_HPP
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_INLINE_HPP
......@@ -27,7 +27,7 @@
#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "memory/allocation.hpp"
#include "memory/padded.inline.hpp"
#include "memory/space.inline.hpp"
......@@ -419,7 +419,7 @@ void OtherRegionsTable::print_from_card_cache() {
}
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
uint cur_hrs_ind = hr()->hrs_index();
uint cur_hrm_ind = hr()->hrm_index();
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
......@@ -434,10 +434,10 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = "INT32_FORMAT")",
hr()->bottom(), from_card,
FromCardCache::at((uint)tid, cur_hrs_ind));
FromCardCache::at((uint)tid, cur_hrm_ind));
}
if (FromCardCache::contains_or_replace((uint)tid, cur_hrs_ind, from_card)) {
if (FromCardCache::contains_or_replace((uint)tid, cur_hrm_ind, from_card)) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" from-card cache hit.");
}
......@@ -447,7 +447,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
// Note that this may be a continued H region.
HeapRegion* from_hr = _g1h->heap_region_containing_raw(from);
RegionIdx_t from_hrs_ind = (RegionIdx_t) from_hr->hrs_index();
RegionIdx_t from_hrs_ind = (RegionIdx_t) from_hr->hrm_index();
// If the region is already coarsened, return.
if (_coarse_map.at(from_hrs_ind)) {
......@@ -493,8 +493,8 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
} else {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" [tid %d] sparse table entry "
"overflow(f: %d, t: %d)",
tid, from_hrs_ind, cur_hrs_ind);
"overflow(f: %d, t: %u)",
tid, from_hrs_ind, cur_hrm_ind);
}
}
......@@ -606,9 +606,9 @@ PerRegionTable* OtherRegionsTable::delete_region_table() {
guarantee(max != NULL, "Since _n_fine_entries > 0");
// Set the corresponding coarse bit.
size_t max_hrs_index = (size_t) max->hr()->hrs_index();
if (!_coarse_map.at(max_hrs_index)) {
_coarse_map.at_put(max_hrs_index, true);
size_t max_hrm_index = (size_t) max->hr()->hrm_index();
if (!_coarse_map.at(max_hrm_index)) {
_coarse_map.at_put(max_hrm_index, true);
_n_coarse_entries++;
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
......@@ -632,7 +632,7 @@ void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
BitMap* region_bm, BitMap* card_bm) {
// First eliminated garbage regions from the coarse map.
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrs_index());
gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrm_index());
}
assert(_coarse_map.size() == region_bm->size(), "Precondition");
......@@ -655,9 +655,9 @@ void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
// If the entire region is dead, eliminate.
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr(" For other region %u:",
cur->hr()->hrs_index());
cur->hr()->hrm_index());
}
if (!region_bm->at((size_t) cur->hr()->hrs_index())) {
if (!region_bm->at((size_t) cur->hr()->hrm_index())) {
*prev = nxt;
cur->set_collision_list_next(NULL);
_n_fine_entries--;
......@@ -751,7 +751,7 @@ size_t OtherRegionsTable::fl_mem_size() {
}
void OtherRegionsTable::clear_fcc() {
FromCardCache::clear(hr()->hrs_index());
FromCardCache::clear(hr()->hrm_index());
}
void OtherRegionsTable::clear() {
......@@ -802,7 +802,7 @@ bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
bool OtherRegionsTable::contains_reference_locked(OopOrNarrowOopStar from) const {
HeapRegion* hr = _g1h->heap_region_containing_raw(from);
RegionIdx_t hr_ind = (RegionIdx_t) hr->hrs_index();
RegionIdx_t hr_ind = (RegionIdx_t) hr->hrm_index();
// Is this region in the coarse map?
if (_coarse_map.at(hr_ind)) return true;
......@@ -839,7 +839,7 @@ uint HeapRegionRemSet::num_par_rem_sets() {
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
HeapRegion* hr)
: _bosa(bosa),
_m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrs_index()), true),
_m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true),
_code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) {
reset_for_par_iteration();
}
......
......@@ -39,11 +39,11 @@ void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
#ifndef PRODUCT
void HeapRegionSetBase::verify_region(HeapRegion* hr) {
assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrs_index()));
assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrs_index())); // currently we don't use these sets for young regions
assert(hr->isHumongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrs_index(), name()));
assert(hr->is_empty() == regions_empty(), err_msg("Wrong empty state for region %u and set %s", hr->hrs_index(), name()));
assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrs_index()));
assert(hr->containing_set() == this, err_msg("Inconsistent containing set for %u", hr->hrm_index()));
assert(!hr->is_young(), err_msg("Adding young region %u", hr->hrm_index())); // currently we don't use these sets for young regions
assert(hr->isHumongous() == regions_humongous(), err_msg("Wrong humongous state for region %u and set %s", hr->hrm_index(), name()));
assert(hr->is_empty() == regions_empty(), err_msg("Wrong empty state for region %u and set %s", hr->hrm_index(), name()));
assert(hr->rem_set()->verify_ready_for_par_iteration(), err_msg("Wrong iteration state %u", hr->hrm_index()));
}
#endif
......@@ -158,7 +158,7 @@ void FreeRegionList::add_ordered(FreeRegionList* from_list) {
HeapRegion* curr_from = from_list->_head;
while (curr_from != NULL) {
while (curr_to != NULL && curr_to->hrs_index() < curr_from->hrs_index()) {
while (curr_to != NULL && curr_to->hrm_index() < curr_from->hrm_index()) {
curr_to = curr_to->next();
}
......@@ -183,7 +183,7 @@ void FreeRegionList::add_ordered(FreeRegionList* from_list) {
}
}
if (_tail->hrs_index() < from_list->_tail->hrs_index()) {
if (_tail->hrm_index() < from_list->_tail->hrm_index()) {
_tail = from_list->_tail;
}
}
......@@ -309,8 +309,8 @@ void FreeRegionList::verify_list() {
if (curr->next() != NULL) {
guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up");
}
guarantee(curr->hrs_index() == 0 || curr->hrs_index() > last_index, "List should be sorted");
last_index = curr->hrs_index();
guarantee(curr->hrm_index() == 0 || curr->hrm_index() > last_index, "List should be sorted");
last_index = curr->hrm_index();
capacity += curr->capacity();
......@@ -319,7 +319,7 @@ void FreeRegionList::verify_list() {
curr = curr->next();
}
guarantee(_tail == prev0, err_msg("Expected %s to end with %u but it ended with %u.", name(), _tail->hrs_index(), prev0->hrs_index()));
guarantee(_tail == prev0, err_msg("Expected %s to end with %u but it ended with %u.", name(), _tail->hrm_index(), prev0->hrm_index()));
guarantee(_tail == NULL || _tail->next() == NULL, "_tail should not have a next");
guarantee(length() == count, err_msg("%s count mismatch. Expected %u, actual %u.", name(), length(), count));
guarantee(total_capacity_bytes() == capacity, err_msg("%s capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT,
......
......@@ -238,14 +238,14 @@ public:
// Add hr to the list. The region should not be a member of another set.
// Assumes that the list is ordered and will preserve that order. The order
// is determined by hrs_index.
// is determined by hrm_index.
inline void add_ordered(HeapRegion* hr);
// Removes from head or tail based on the given argument.
HeapRegion* remove_region(bool from_head);
// Merge two ordered lists. The result is also ordered. The order is
// determined by hrs_index.
// determined by hrm_index.
void add_ordered(FreeRegionList* from_list);
// It empties the list by removing all regions from it.
......
......@@ -60,14 +60,14 @@ inline void FreeRegionList::add_ordered(HeapRegion* hr) {
if (_head != NULL) {
HeapRegion* curr;
if (_last != NULL && _last->hrs_index() < hr->hrs_index()) {
if (_last != NULL && _last->hrm_index() < hr->hrm_index()) {
curr = _last;
} else {
curr = _head;
}
// Find first entry with a Region Index larger than entry to insert.
while (curr != NULL && curr->hrs_index() < hr->hrs_index()) {
while (curr != NULL && curr->hrm_index() < hr->hrm_index()) {
curr = curr->next();
}
......
......@@ -478,7 +478,7 @@ size_t SparsePRT::mem_size() const {
bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) {
#if SPARSE_PRT_VERBOSE
gclog_or_tty->print_cr(" Adding card %d from region %d to region %u sparse.",
card_index, region_id, _hr->hrs_index());
card_index, region_id, _hr->hrm_index());
#endif
if (_next->occupied_entries() * 2 > _next->capacity()) {
expand();
......@@ -530,7 +530,7 @@ void SparsePRT::expand() {
#if SPARSE_PRT_VERBOSE
gclog_or_tty->print_cr(" Expanded sparse table for %u to %d.",
_hr->hrs_index(), _next->capacity());
_hr->hrm_index(), _next->capacity());
#endif
for (size_t i = 0; i < last->capacity(); i++) {
SparsePRTEntry* e = last->entry((int)i);
......
......@@ -26,7 +26,7 @@
#define SHARE_VM_GC_IMPLEMENTATION_G1_VMSTRUCTS_G1_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/g1CollectedHeap.inline.hpp"
#define VM_STRUCTS_G1(nonstatic_field, static_field) \
......@@ -42,10 +42,10 @@
nonstatic_field(G1HeapRegionTable, _bias, size_t) \
nonstatic_field(G1HeapRegionTable, _shift_by, uint) \
\
nonstatic_field(HeapRegionSeq, _regions, G1HeapRegionTable) \
nonstatic_field(HeapRegionSeq, _num_committed, uint) \
nonstatic_field(HeapRegionManager, _regions, G1HeapRegionTable) \
nonstatic_field(HeapRegionManager, _num_committed, uint) \
\
nonstatic_field(G1CollectedHeap, _hrs, HeapRegionSeq) \
nonstatic_field(G1CollectedHeap, _hrm, HeapRegionManager) \
nonstatic_field(G1CollectedHeap, _summary_bytes_used, size_t) \
nonstatic_field(G1CollectedHeap, _g1mm, G1MonitoringSupport*) \
nonstatic_field(G1CollectedHeap, _old_set, HeapRegionSetBase) \
......@@ -72,7 +72,7 @@
\
declare_type(G1OffsetTableContigSpace, CompactibleSpace) \
declare_type(HeapRegion, G1OffsetTableContigSpace) \
declare_toplevel_type(HeapRegionSeq) \
declare_toplevel_type(HeapRegionManager) \
declare_toplevel_type(HeapRegionSetBase) \
declare_toplevel_type(HeapRegionSetCount) \
declare_toplevel_type(G1MonitoringSupport) \
......
......@@ -66,7 +66,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
......
......@@ -42,7 +42,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
......
......@@ -38,7 +38,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
......
......@@ -51,7 +51,7 @@
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
#include "gc_implementation/g1/g1RemSet.inline.hpp"
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册