src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

Print this page
rev 6673 : 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:
rev 6674 : imported patch fixes-kim


1144   virtual size_t used() const;
1145   // This should be called when we're not holding the heap lock. The
1146   // result might be a bit inaccurate.
1147   size_t used_unlocked() const;
1148   size_t recalculate_used() const;
1149 
1150   // These virtual functions do the actual allocation.
1151   // Some heaps may offer a contiguous region for shared non-blocking
1152   // allocation, via inlined code (by exporting the address of the top and
1153   // end fields defining the extent of the contiguous allocation region.)
1154   // But G1CollectedHeap doesn't yet support this.
1155 
1156   virtual bool is_maximal_no_gc() const {
1157     return _g1_storage.uncommitted_size() == 0;
1158   }
1159 
1160   // The total number of regions in the heap.
1161   uint n_regions() const { return _hrs.length(); }
1162 
1163   // The max number of regions in the heap.
1164   uint max_regions() { return _hrs.max_length(); }
1165 
1166   // The number of regions that are completely free.
1167   uint free_regions() { return _free_list.length(); }
1168 
1169   // The number of regions that are not completely free.
1170   uint used_regions() { return n_regions() - free_regions(); }
1171 
1172   // The number of regions available for "regular" expansion.
1173   uint expansion_regions() { return _expansion_regions; }
1174 
1175   // Factory method for HeapRegion instances. It will return NULL if
1176   // the allocation fails.
1177   HeapRegion* new_heap_region(uint hrs_index, HeapWord* bottom);
1178 
1179   void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1180   void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1181   void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
1182   void verify_dirty_young_regions() PRODUCT_RETURN;
1183 
1184 #ifndef PRODUCT
1185   // Make sure that the given bitmap has no marked objects in the
1186   // range [from,limit). If it does, print an error message and return
1187   // false. Otherwise, just return true. bitmap_name should be "prev"
1188   // or "next".
1189   bool verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
1190                                 HeapWord* from, HeapWord* limit);
1191 
1192   // Verify that the prev / next bitmap range [tams,end) for the given
1193   // region has no marks. Return true if all is well, false if errors




1144   virtual size_t used() const;
1145   // This should be called when we're not holding the heap lock. The
1146   // result might be a bit inaccurate.
1147   size_t used_unlocked() const;
1148   size_t recalculate_used() const;
1149 
1150   // These virtual functions do the actual allocation.
1151   // Some heaps may offer a contiguous region for shared non-blocking
1152   // allocation, via inlined code (by exporting the address of the top and
1153   // end fields defining the extent of the contiguous allocation region.)
1154   // But G1CollectedHeap doesn't yet support this.
1155 
1156   virtual bool is_maximal_no_gc() const {
1157     return _g1_storage.uncommitted_size() == 0;
1158   }
1159 
1160   // The total number of regions in the heap.
1161   uint n_regions() const { return _hrs.length(); }
1162 
1163   // The max number of regions in the heap.
1164   uint max_regions() const { return _hrs.max_length(); }
1165 
1166   // The number of regions that are completely free.
1167   uint free_regions() const { return _free_list.length(); }
1168 
1169   // The number of regions that are not completely free.
1170   uint used_regions() const { return n_regions() - free_regions(); }
1171 
1172   // The number of regions available for "regular" expansion.
1173   uint expansion_regions() const { return _expansion_regions; }
1174 
1175   // Factory method for HeapRegion instances. It will return NULL if
1176   // the allocation fails.
1177   HeapRegion* new_heap_region(uint hrs_index, HeapWord* bottom);
1178 
1179   void verify_not_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1180   void verify_dirty_region(HeapRegion* hr) PRODUCT_RETURN;
1181   void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
1182   void verify_dirty_young_regions() PRODUCT_RETURN;
1183 
1184 #ifndef PRODUCT
1185   // Make sure that the given bitmap has no marked objects in the
1186   // range [from,limit). If it does, print an error message and return
1187   // false. Otherwise, just return true. bitmap_name should be "prev"
1188   // or "next".
1189   bool verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
1190                                 HeapWord* from, HeapWord* limit);
1191 
1192   // Verify that the prev / next bitmap range [tams,end) for the given
1193   // region has no marks. Return true if all is well, false if errors