< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.hpp

Print this page
rev 55208 : imported patch 8220089.webrev.0
rev 55209 : imported patch 8220089.webrev.1
rev 55210 : imported patch 8220089.webrev.2
rev 55211 : imported patch 8220089.webrev.3

@@ -133,10 +133,11 @@
   friend class VM_CollectForMetadataAllocation;
   friend class VM_G1CollectForAllocation;
   friend class VM_G1CollectFull;
   friend class VMStructs;
   friend class MutatorAllocRegion;
+  friend class G1Allocator;
   friend class G1FullCollector;
   friend class G1GCAllocRegion;
   friend class G1HeapVerifier;
 
   // Closures used in implementation.

@@ -457,20 +458,24 @@
                                             bool expect_null_mutator_alloc_region);
 
   // These methods are the "callbacks" from the G1AllocRegion class.
 
   // For mutator alloc regions.
+  void update_as_mutator_region(HeapRegion* alloc_region, bool is_reused);
   HeapRegion* new_mutator_alloc_region(size_t word_size, bool force);
   void retire_mutator_alloc_region(HeapRegion* alloc_region,
                                    size_t allocated_bytes);
+  void reuse_retained_survivor_region(HeapRegion* alloc_region);
 
   // For GC alloc regions.
   bool has_more_regions(G1HeapRegionAttr dest);
   HeapRegion* new_gc_alloc_region(size_t word_size, G1HeapRegionAttr dest);
   void retire_gc_alloc_region(HeapRegion* alloc_region,
                               size_t allocated_bytes, G1HeapRegionAttr dest);
 
+  void update_retained_survivor_gc_alloc_region(HeapRegion* alloc_region);
+
   // - if explicit_gc is true, the GC is for a System.gc() etc,
   //   otherwise it's for a failed allocation.
   // - if clear_all_soft_refs is true, all soft references should be
   //   cleared during the GC.
   // - it returns false if it is unable to do the collection due to the

@@ -1250,23 +1255,35 @@
   // Convenience function to be used in situations where the heap type can be
   // asserted to be this type.
   static G1CollectedHeap* heap();
 
   void set_region_short_lived_locked(HeapRegion* hr);
+  // Used to re-set survivor region to eden region.
+  void set_retained_region_short_lived_locked(HeapRegion* hr);
   // add appropriate methods for any other surv rate groups
 
   const G1SurvivorRegions* survivor() const { return &_survivor; }
 
-  uint eden_regions_count() const { return _eden.length(); }
-  uint survivor_regions_count() const { return _survivor.length(); }
-  size_t eden_regions_used_bytes() const { return _eden.used_bytes(); }
-  size_t survivor_regions_used_bytes() const { return _survivor.used_bytes(); }
+  // Returns eden region count without any retained region.
+  // At the end of GC, all retained regions were already added to _eden so
+  // we have to subtract the retained region count to return only eden regions.
+  uint eden_regions_count() const;
+  // Returns survivor region count with retained region.
+  // At the end of GC, all retained regions were already removed from _survivor so
+  // we have to add the retained region count to return survivor regions.
+  uint survivor_regions_count() const;
+  // Returns used bytes of mutator regions without used bytes of a retained region.
+  size_t eden_regions_used_bytes() const;
+  // Returns used bytes of survivor regions with used bytes of a retained region.
+  size_t survivor_regions_used_bytes() const;
   uint young_regions_count() const { return _eden.length() + _survivor.length(); }
   uint old_regions_count() const { return _old_set.length(); }
   uint archive_regions_count() const { return _archive_set.length(); }
   uint humongous_regions_count() const { return _humongous_set.length(); }
 
+  void convert_survivor_to_eden() { _survivor.convert_to_eden(); }
+
 #ifdef ASSERT
   bool check_young_list_empty();
 #endif
 
   // *** Stuff related to concurrent marking.  It's not clear to me that so
< prev index next >