comparison src/share/vm/gc_implementation/g1/heapRegion.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 063382f9b575
children 6747fd0512e0
comparison
equal deleted inserted replaced
3765:ae5b2f1dcf12 3766:c3f1170908be
157 if (!_failures) { 157 if (!_failures) {
158 gclog_or_tty->print_cr(""); 158 gclog_or_tty->print_cr("");
159 gclog_or_tty->print_cr("----------"); 159 gclog_or_tty->print_cr("----------");
160 } 160 }
161 gclog_or_tty->print_cr("Missing rem set entry:"); 161 gclog_or_tty->print_cr("Missing rem set entry:");
162 gclog_or_tty->print_cr("Field "PTR_FORMAT 162 gclog_or_tty->print_cr("Field "PTR_FORMAT" "
163 " of obj "PTR_FORMAT 163 "of obj "PTR_FORMAT", "
164 ", in region %d ["PTR_FORMAT 164 "in region "HR_FORMAT,
165 ", "PTR_FORMAT"),", 165 p, (void*) _containing_obj,
166 p, (void*) _containing_obj, 166 HR_FORMAT_PARAMS(from));
167 from->hrs_index(),
168 from->bottom(),
169 from->end());
170 _containing_obj->print_on(gclog_or_tty); 167 _containing_obj->print_on(gclog_or_tty);
171 gclog_or_tty->print_cr("points to obj "PTR_FORMAT 168 gclog_or_tty->print_cr("points to obj "PTR_FORMAT" "
172 " in region %d ["PTR_FORMAT 169 "in region "HR_FORMAT,
173 ", "PTR_FORMAT").", 170 (void*) obj,
174 (void*) obj, to->hrs_index(), 171 HR_FORMAT_PARAMS(to));
175 to->bottom(), to->end());
176 obj->print_on(gclog_or_tty); 172 obj->print_on(gclog_or_tty);
177 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", 173 gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.",
178 cv_obj, cv_field); 174 cv_obj, cv_field);
179 gclog_or_tty->print_cr("----------"); 175 gclog_or_tty->print_cr("----------");
180 _failures = true; 176 _failures = true;
482 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list 478 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
483 #endif // _MSC_VER 479 #endif // _MSC_VER
484 480
485 481
486 HeapRegion:: 482 HeapRegion::
487 HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray, 483 HeapRegion(size_t hrs_index, G1BlockOffsetSharedArray* sharedOffsetArray,
488 MemRegion mr, bool is_zeroed) 484 MemRegion mr, bool is_zeroed)
489 : G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed), 485 : G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed),
490 _next_fk(HeapRegionDCTOC::NoFilterKind), 486 _next_fk(HeapRegionDCTOC::NoFilterKind), _hrs_index(hrs_index),
491 _hrs_index(-1),
492 _humongous_type(NotHumongous), _humongous_start_region(NULL), 487 _humongous_type(NotHumongous), _humongous_start_region(NULL),
493 _in_collection_set(false), _is_gc_alloc_region(false), 488 _in_collection_set(false), _is_gc_alloc_region(false),
494 _next_in_special_set(NULL), _orig_end(NULL), 489 _next_in_special_set(NULL), _orig_end(NULL),
495 _claimed(InitialClaimValue), _evacuation_failed(false), 490 _claimed(InitialClaimValue), _evacuation_failed(false),
496 _prev_marked_bytes(0), _next_marked_bytes(0), _sort_index(-1), 491 _prev_marked_bytes(0), _next_marked_bytes(0), _sort_index(-1),