6700789: G1: Enable use of compressed oops with G1 heaps

Modifications to G1 so as to allow the use of compressed oops.

Reviewed-by: apetrusenko, coleenp, jmasa, kvn, never, phh, tonyp
This commit is contained in:
Y. Srinivas Ramakrishna 2009-07-14 15:40:39 -07:00
parent 50d7db1805
commit 075c1335cb
58 changed files with 1233 additions and 1175 deletions

View file

@ -126,7 +126,7 @@ protected:
}
}
void add_reference_work(oop* from, bool par) {
void add_reference_work(OopOrNarrowOopStar from, bool par) {
// Must make this robust in case "from" is not in "_hr", because of
// concurrency.
@ -173,11 +173,11 @@ public:
_bm.clear();
}
void add_reference(oop* from) {
void add_reference(OopOrNarrowOopStar from) {
add_reference_work(from, /*parallel*/ true);
}
void seq_add_reference(oop* from) {
void seq_add_reference(OopOrNarrowOopStar from) {
add_reference_work(from, /*parallel*/ false);
}
@ -220,7 +220,7 @@ public:
}
// Requires "from" to be in "hr()".
bool contains_reference(oop* from) const {
bool contains_reference(OopOrNarrowOopStar from) const {
assert(hr()->is_in_reserved(from), "Precondition.");
size_t card_ind = pointer_delta(from, hr()->bottom(),
CardTableModRefBS::card_size);
@ -394,7 +394,7 @@ public:
void set_next(PosParPRT* nxt) { _next = nxt; }
PosParPRT** next_addr() { return &_next; }
void add_reference(oop* from, int tid) {
void add_reference(OopOrNarrowOopStar from, int tid) {
// Expand if necessary.
PerRegionTable** pt = par_tables();
if (par_tables() == NULL && tid > 0 && hr()->is_gc_alloc_region()) {
@ -447,7 +447,7 @@ public:
return res;
}
bool contains_reference(oop* from) const {
bool contains_reference(OopOrNarrowOopStar from) const {
if (PerRegionTable::contains_reference(from)) return true;
if (_par_tables != NULL) {
for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets()-1; i++) {
@ -564,12 +564,15 @@ void OtherRegionsTable::print_from_card_cache() {
}
#endif
void OtherRegionsTable::add_reference(oop* from, int tid) {
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
size_t cur_hrs_ind = hr()->hrs_index();
#if HRRS_VERBOSE
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
from, *from);
from,
UseCompressedOops
? oopDesc::load_decode_heap_oop((narrowOop*)from)
: oopDesc::load_decode_heap_oop((oop*)from));
#endif
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
@ -1021,13 +1024,13 @@ bool OtherRegionsTable::del_single_region_table(size_t ind,
}
}
bool OtherRegionsTable::contains_reference(oop* from) const {
bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
// Cast away const in this case.
MutexLockerEx x((Mutex*)&_m, Mutex::_no_safepoint_check_flag);
return contains_reference_locked(from);
}
bool OtherRegionsTable::contains_reference_locked(oop* from) const {
bool OtherRegionsTable::contains_reference_locked(OopOrNarrowOopStar from) const {
HeapRegion* hr = _g1h->heap_region_containing_raw(from);
if (hr == NULL) return false;
RegionIdx_t hr_ind = (RegionIdx_t) hr->hrs_index();
@ -1288,24 +1291,24 @@ bool HeapRegionRemSetIterator::has_next(size_t& card_index) {
oop** HeapRegionRemSet::_recorded_oops = NULL;
HeapWord** HeapRegionRemSet::_recorded_cards = NULL;
HeapRegion** HeapRegionRemSet::_recorded_regions = NULL;
int HeapRegionRemSet::_n_recorded = 0;
OopOrNarrowOopStar* HeapRegionRemSet::_recorded_oops = NULL;
HeapWord** HeapRegionRemSet::_recorded_cards = NULL;
HeapRegion** HeapRegionRemSet::_recorded_regions = NULL;
int HeapRegionRemSet::_n_recorded = 0;
HeapRegionRemSet::Event* HeapRegionRemSet::_recorded_events = NULL;
int* HeapRegionRemSet::_recorded_event_index = NULL;
int HeapRegionRemSet::_n_recorded_events = 0;
void HeapRegionRemSet::record(HeapRegion* hr, oop* f) {
void HeapRegionRemSet::record(HeapRegion* hr, OopOrNarrowOopStar f) {
if (_recorded_oops == NULL) {
assert(_n_recorded == 0
&& _recorded_cards == NULL
&& _recorded_regions == NULL,
"Inv");
_recorded_oops = NEW_C_HEAP_ARRAY(oop*, MaxRecorded);
_recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded);
_recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded);
_recorded_oops = NEW_C_HEAP_ARRAY(OopOrNarrowOopStar, MaxRecorded);
_recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded);
_recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded);
}
if (_n_recorded == MaxRecorded) {
gclog_or_tty->print_cr("Filled up 'recorded' (%d).", MaxRecorded);
@ -1408,21 +1411,21 @@ void HeapRegionRemSet::test() {
HeapRegionRemSet* hrrs = hr0->rem_set();
// Make three references from region 0x101...
hrrs->add_reference((oop*)hr1_start);
hrrs->add_reference((oop*)hr1_mid);
hrrs->add_reference((oop*)hr1_last);
hrrs->add_reference((OopOrNarrowOopStar)hr1_start);
hrrs->add_reference((OopOrNarrowOopStar)hr1_mid);
hrrs->add_reference((OopOrNarrowOopStar)hr1_last);
hrrs->add_reference((oop*)hr2_start);
hrrs->add_reference((oop*)hr2_mid);
hrrs->add_reference((oop*)hr2_last);
hrrs->add_reference((OopOrNarrowOopStar)hr2_start);
hrrs->add_reference((OopOrNarrowOopStar)hr2_mid);
hrrs->add_reference((OopOrNarrowOopStar)hr2_last);
hrrs->add_reference((oop*)hr3_start);
hrrs->add_reference((oop*)hr3_mid);
hrrs->add_reference((oop*)hr3_last);
hrrs->add_reference((OopOrNarrowOopStar)hr3_start);
hrrs->add_reference((OopOrNarrowOopStar)hr3_mid);
hrrs->add_reference((OopOrNarrowOopStar)hr3_last);
// Now cause a coarsening.
hrrs->add_reference((oop*)hr4->bottom());
hrrs->add_reference((oop*)hr5->bottom());
hrrs->add_reference((OopOrNarrowOopStar)hr4->bottom());
hrrs->add_reference((OopOrNarrowOopStar)hr5->bottom());
// Now, does iteration yield these three?
HeapRegionRemSetIterator iter;