Mercurial > hg > truffle
diff src/share/vm/gc_implementation/g1/heapRegion.hpp @ 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 | 063382f9b575 |
children | 6747fd0512e0 |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/heapRegion.hpp Wed Jun 08 21:48:38 2011 -0400 +++ b/src/share/vm/gc_implementation/g1/heapRegion.hpp Fri Jun 10 13:16:40 2011 -0400 @@ -52,9 +52,11 @@ class HeapRegion; class HeapRegionSetBase; -#define HR_FORMAT "%d:["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]" -#define HR_FORMAT_PARAMS(_hr_) (_hr_)->hrs_index(), (_hr_)->bottom(), \ - (_hr_)->top(), (_hr_)->end() +#define HR_FORMAT SIZE_FORMAT":(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]" +#define HR_FORMAT_PARAMS(_hr_) \ + (_hr_)->hrs_index(), \ + (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : "-", \ + (_hr_)->bottom(), (_hr_)->top(), (_hr_)->end() // A dirty card to oop closure for heap regions. It // knows how to get the G1 heap and how to use the bitmap @@ -237,9 +239,8 @@ G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; } protected: - // If this region is a member of a HeapRegionSeq, the index in that - // sequence, otherwise -1. - int _hrs_index; + // The index of this region in the heap region sequence. + size_t _hrs_index; HumongousType _humongous_type; // For a humongous region, region in which it starts. @@ -296,8 +297,7 @@ enum YoungType { NotYoung, // a region is not young Young, // a region is young - Survivor // a region is young and it contains - // survivor + Survivor // a region is young and it contains survivors }; volatile YoungType _young_type; @@ -351,7 +351,8 @@ public: // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros. - HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray, + HeapRegion(size_t hrs_index, + G1BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr, bool is_zeroed); static int LogOfHRGrainBytes; @@ -393,8 +394,7 @@ // If this region is a member of a HeapRegionSeq, the index in that // sequence, otherwise -1. - int hrs_index() const { return _hrs_index; } - void set_hrs_index(int index) { _hrs_index = index; } + size_t hrs_index() const { return _hrs_index; } // The number of bytes marked live in the region in the last marking phase. size_t marked_bytes() { return _prev_marked_bytes; } @@ -579,6 +579,8 @@ void set_next_dirty_cards_region(HeapRegion* hr) { _next_dirty_cards_region = hr; } bool is_on_dirty_cards_region_list() const { return get_next_dirty_cards_region() != NULL; } + HeapWord* orig_end() { return _orig_end; } + // Allows logical separation between objects allocated before and after. void save_marks();