< prev index next >

src/hotspot/share/gc/g1/g1SurvivorRegions.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


  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_G1_G1SURVIVORREGIONS_HPP
  26 #define SHARE_GC_G1_G1SURVIVORREGIONS_HPP
  27 
  28 #include "runtime/globals.hpp"
  29 
  30 template <typename T>
  31 class GrowableArray;
  32 class HeapRegion;
  33 
  34 class G1SurvivorRegions {
  35 private:
  36   GrowableArray<HeapRegion*>* _regions;
  37   volatile size_t             _used_bytes;





  38 
  39 public:
  40   G1SurvivorRegions();
  41 
  42   void add(HeapRegion* hr);
  43 




  44   void convert_to_eden();
  45 
  46   void clear();
  47 


  48   uint length() const;
  49 



  50   const GrowableArray<HeapRegion*>* regions() const {
  51     return _regions;
  52   }
  53 
  54   // Used bytes of all survivor regions.






  55   size_t used_bytes() const { return _used_bytes; }
  56 
  57   void add_used_bytes(size_t used_bytes);
  58 };
  59 
  60 #endif // SHARE_GC_G1_G1SURVIVORREGIONS_HPP


  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_G1_G1SURVIVORREGIONS_HPP
  26 #define SHARE_GC_G1_G1SURVIVORREGIONS_HPP
  27 
  28 #include "runtime/globals.hpp"
  29 
  30 template <typename T>
  31 class GrowableArray;
  32 class HeapRegion;
  33 
  34 class G1SurvivorRegions {
  35 private:
  36   GrowableArray<HeapRegion*>* _regions;
  37   volatile size_t             _used_bytes;
  38   // When a heap region is retired add_used_bytes() will be called to update its used bytes.
  39   // But when the heap region is retained, that heap region's used bytes must be subtracted
  40   // because it will be reused as a mutator region. Save that value in _retained_used_bytes.
  41   size_t                      _retained_used_bytes;
  42   uint                        _retained_regions;
  43 
  44 public:
  45   G1SurvivorRegions();
  46 
  47   void add(HeapRegion* hr);
  48 
  49   // Remove the heap region from _regions.
  50   // Later the removed heap region will be used as a mutator region.
  51   void remove(HeapRegion* hr);
  52 
  53   void convert_to_eden();
  54 
  55   void clear();
  56 
  57   // Total of heap regions at _regions.
  58   // I.e. heap regions tagged as a survivor.
  59   uint length() const;
  60 
  61   // Returns 0 or 1 which is retained region count.
  62   uint retained_length() const;
  63 
  64   const GrowableArray<HeapRegion*>* regions() const {
  65     return _regions;
  66   }
  67 
  68   void add_used_bytes(size_t used_bytes);
  69 
  70   // Returns used bytes of retired survivor regions not including used bytes of
  71   // any retained region. When Heap_lock is not held, G1CollectedHeap::_summary_bytes_used
  72   // is referred to get used bytes of non-allocating heap regions. In such case,
  73   // the used bytes of any retained region should not be included as it has already been changed
  74   // to a mutator region.
  75   size_t used_bytes() const { return _used_bytes; }
  76 
  77   size_t retained_used_bytes() const { return _retained_used_bytes; }
  78 };
  79 
  80 #endif // SHARE_GC_G1_G1SURVIVORREGIONS_HPP
< prev index next >