comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 636:6c4cea9bfa11

6604422: G1: re-use half-promoted regions 6728271: G1: Cleanup G1CollectedHeap::get_gc_alloc_regions() Summary: It allows the last half-full region to be allocated to during a GC to be reused during the next GC. Reviewed-by: apetrusenko, jcoomes
author tonyp
date Sun, 15 Mar 2009 22:03:38 -0400
parents 4f360ec815ba
children ba50942c8138
comparison
equal deleted inserted replaced
635:fe2441500281 636:6c4cea9bfa11
170 VeryLargeInWords = VeryLargeInBytes/HeapWordSize, 170 VeryLargeInWords = VeryLargeInBytes/HeapWordSize,
171 MinHeapDeltaBytes = 10 * HeapRegion::GrainBytes, // FIXME 171 MinHeapDeltaBytes = 10 * HeapRegion::GrainBytes, // FIXME
172 NumAPIs = HeapRegion::MaxAge 172 NumAPIs = HeapRegion::MaxAge
173 }; 173 };
174 174
175
176 // The one and only G1CollectedHeap, so static functions can find it. 175 // The one and only G1CollectedHeap, so static functions can find it.
177 static G1CollectedHeap* _g1h; 176 static G1CollectedHeap* _g1h;
178 177
179 // Storage for the G1 heap (excludes the permanent generation). 178 // Storage for the G1 heap (excludes the permanent generation).
180 VirtualSpace _g1_storage; 179 VirtualSpace _g1_storage;
215 // allocated. May be NULL. 214 // allocated. May be NULL.
216 HeapRegion* _cur_alloc_region; 215 HeapRegion* _cur_alloc_region;
217 216
218 // Postcondition: cur_alloc_region == NULL. 217 // Postcondition: cur_alloc_region == NULL.
219 void abandon_cur_alloc_region(); 218 void abandon_cur_alloc_region();
219 void abandon_gc_alloc_regions();
220 220
221 // The to-space memory regions into which objects are being copied during 221 // The to-space memory regions into which objects are being copied during
222 // a GC. 222 // a GC.
223 HeapRegion* _gc_alloc_regions[GCAllocPurposeCount]; 223 HeapRegion* _gc_alloc_regions[GCAllocPurposeCount];
224 size_t _gc_alloc_region_counts[GCAllocPurposeCount]; 224 size_t _gc_alloc_region_counts[GCAllocPurposeCount];
225 // These are the regions, one per GCAllocPurpose, that are half-full
226 // at the end of a collection and that we want to reuse during the
227 // next collection.
228 HeapRegion* _retained_gc_alloc_regions[GCAllocPurposeCount];
229 // This specifies whether we will keep the last half-full region at
230 // the end of a collection so that it can be reused during the next
231 // collection (this is specified per GCAllocPurpose)
232 bool _retain_gc_alloc_region[GCAllocPurposeCount];
225 233
226 // A list of the regions that have been set to be alloc regions in the 234 // A list of the regions that have been set to be alloc regions in the
227 // current collection. 235 // current collection.
228 HeapRegion* _gc_alloc_region_list; 236 HeapRegion* _gc_alloc_region_list;
229 237
587 void handle_evacuation_failure_common(oop obj, markOop m); 595 void handle_evacuation_failure_common(oop obj, markOop m);
588 596
589 597
590 // Ensure that the relevant gc_alloc regions are set. 598 // Ensure that the relevant gc_alloc regions are set.
591 void get_gc_alloc_regions(); 599 void get_gc_alloc_regions();
592 // We're done with GC alloc regions; release them, as appropriate. 600 // We're done with GC alloc regions. We are going to tear down the
593 void release_gc_alloc_regions(); 601 // gc alloc list and remove the gc alloc tag from all the regions on
602 // that list. However, we will also retain the last (i.e., the one
603 // that is half-full) GC alloc region, per GCAllocPurpose, for
604 // possible reuse during the next collection, provided
605 // _retain_gc_alloc_region[] indicates that it should be the
606 // case. Said regions are kept in the _retained_gc_alloc_regions[]
607 // array. If the parameter totally is set, we will not retain any
608 // regions, irrespective of what _retain_gc_alloc_region[]
609 // indicates.
610 void release_gc_alloc_regions(bool totally);
611 #ifndef PRODUCT
612 // Useful for debugging.
613 void print_gc_alloc_regions();
614 #endif // !PRODUCT
594 615
595 // ("Weak") Reference processing support 616 // ("Weak") Reference processing support
596 ReferenceProcessor* _ref_processor; 617 ReferenceProcessor* _ref_processor;
597 618
598 enum G1H_process_strong_roots_tasks { 619 enum G1H_process_strong_roots_tasks {