src/share/vm/memory/space.hpp

Print this page
rev 6668 : 8048112: G1 Full GC needs to support the case when the very first region is not available
Summary: To allow uncommit of regions within the heap, G1 Full GC should correctly handle the case when the very first region is not available (uncommitted). Provide support for that by lazily initializing the compaction point during iteration of the list of heap regions. Further refactor the code to let the G1CollectedHeap handle finding the next region to compact into.
Reviewed-by:


 313   void do_MemRegion(MemRegion mr);
 314 
 315   void set_min_done(HeapWord* min_done) {
 316     _min_done = min_done;
 317     NOT_PRODUCT(_last_explicit_min_done = _min_done);
 318   }
 319 #ifndef PRODUCT
 320   void set_last_bottom(HeapWord* last_bottom) {
 321     _last_bottom = last_bottom;
 322   }
 323 #endif
 324 };
 325 
 326 // A structure to represent a point at which objects are being copied
 327 // during compaction.
 328 class CompactPoint : public StackObj {
 329 public:
 330   Generation* gen;
 331   CompactibleSpace* space;
 332   HeapWord* threshold;



 333   CompactPoint(Generation* _gen, CompactibleSpace* _space,
 334                HeapWord* _threshold) :
 335     gen(_gen), space(_space), threshold(_threshold) {}
 336 };
 337 
 338 
 339 // A space that supports compaction operations.  This is usually, but not
 340 // necessarily, a space that is normally contiguous.  But, for example, a
 341 // free-list-based space whose normal collection is a mark-sweep without
 342 // compaction could still support compaction in full GC's.
 343 
 344 class CompactibleSpace: public Space {
 345   friend class VMStructs;
 346   friend class CompactibleFreeListSpace;
 347 private:
 348   HeapWord* _compaction_top;
 349   CompactibleSpace* _next_compaction_space;
 350 
 351 public:
 352   CompactibleSpace() :




 313   void do_MemRegion(MemRegion mr);
 314 
 315   void set_min_done(HeapWord* min_done) {
 316     _min_done = min_done;
 317     NOT_PRODUCT(_last_explicit_min_done = _min_done);
 318   }
 319 #ifndef PRODUCT
 320   void set_last_bottom(HeapWord* last_bottom) {
 321     _last_bottom = last_bottom;
 322   }
 323 #endif
 324 };
 325 
 326 // A structure to represent a point at which objects are being copied
 327 // during compaction.
 328 class CompactPoint : public StackObj {
 329 public:
 330   Generation* gen;
 331   CompactibleSpace* space;
 332   HeapWord* threshold;
 333 
 334   CompactPoint() : gen(NULL), space(NULL), threshold(0) {}
 335 
 336   CompactPoint(Generation* _gen, CompactibleSpace* _space,
 337                HeapWord* _threshold) :
 338     gen(_gen), space(_space), threshold(_threshold) {}
 339 };
 340 
 341 
 342 // A space that supports compaction operations.  This is usually, but not
 343 // necessarily, a space that is normally contiguous.  But, for example, a
 344 // free-list-based space whose normal collection is a mark-sweep without
 345 // compaction could still support compaction in full GC's.
 346 
 347 class CompactibleSpace: public Space {
 348   friend class VMStructs;
 349   friend class CompactibleFreeListSpace;
 350 private:
 351   HeapWord* _compaction_top;
 352   CompactibleSpace* _next_compaction_space;
 353 
 354 public:
 355   CompactibleSpace() :