Mercurial > hg > truffle
diff src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @ 3766:c3f1170908be
7045330: G1: Simplify/fix the HeapRegionSeq class
7042285: G1: native memory leak during humongous object allocation
6804436: G1: heap region indices should be size_t
Summary: A series of fixes and improvements to the HeapRegionSeq class: a) replace the _regions growable array with a standard C array, b) avoid de-allocating / re-allocating HeapRegion instances when the heap shrinks / grows (fix for 7042285), c) introduce fast method to map address to HeapRegion via a "biased" array pointer, d) embed the _hrs object in G1CollectedHeap, instead of pointing to it via an indirection, e) assume that all the regions added to the HeapRegionSeq instance are contiguous, f) replace int's with size_t's for indexes (and expand that to HeapRegion as part of 6804436), g) remove unnecessary / unused methods, h) rename a couple of fields (_alloc_search_start and _seq_bottom), i) fix iterate_from() not to always start from index 0 irrespective of the region passed to it, j) add a verification method to check the HeapRegionSeq assumptions, k) always call the wrappers for _hrs.iterate(), _hrs_length(), and _hrs.at() from G1CollectedHeap, not those methods directly, and l) unify the code that expands the sequence (by either re-using or creating a new HeapRegion) and make it robust wrt to a HeapRegion allocation failing.
Reviewed-by: stefank, johnc, brutisso
author | tonyp |
---|---|
date | Fri, 10 Jun 2011 13:16:40 -0400 |
parents | 97ba643ea3ed |
children | e8b0b0392037 |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Wed Jun 08 21:48:38 2011 -0400 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Fri Jun 10 13:16:40 2011 -0400 @@ -834,7 +834,7 @@ #endif // Set the corresponding coarse bit. - int max_hrs_index = max->hr()->hrs_index(); + size_t max_hrs_index = max->hr()->hrs_index(); if (!_coarse_map.at(max_hrs_index)) { _coarse_map.at_put(max_hrs_index, true); _n_coarse_entries++; @@ -860,7 +860,8 @@ BitMap* region_bm, BitMap* card_bm) { // First eliminated garbage regions from the coarse map. if (G1RSScrubVerbose) - gclog_or_tty->print_cr("Scrubbing region %d:", hr()->hrs_index()); + gclog_or_tty->print_cr("Scrubbing region "SIZE_FORMAT":", + hr()->hrs_index()); assert(_coarse_map.size() == region_bm->size(), "Precondition"); if (G1RSScrubVerbose) @@ -878,7 +879,8 @@ PosParPRT* nxt = cur->next(); // If the entire region is dead, eliminate. if (G1RSScrubVerbose) - gclog_or_tty->print_cr(" For other region %d:", cur->hr()->hrs_index()); + gclog_or_tty->print_cr(" For other region "SIZE_FORMAT":", + cur->hr()->hrs_index()); if (!region_bm->at(cur->hr()->hrs_index())) { *prev = nxt; cur->set_next(NULL); @@ -994,7 +996,7 @@ void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) { MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); - size_t hrs_ind = (size_t)from_hr->hrs_index(); + size_t hrs_ind = from_hr->hrs_index(); size_t ind = hrs_ind & _mod_max_fine_entries_mask; if (del_single_region_table(ind, from_hr)) { assert(!_coarse_map.at(hrs_ind), "Inv"); @@ -1002,7 +1004,7 @@ _coarse_map.par_at_put(hrs_ind, 0); } // Check to see if any of the fcc entries come from here. - int hr_ind = hr()->hrs_index(); + size_t hr_ind = hr()->hrs_index(); for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) { int fcc_ent = _from_card_cache[tid][hr_ind]; if (fcc_ent != -1) {