hotspot/src/share/vm/gc/g1/youngList.hpp
changeset 38183 cb68e4923223
parent 38162 4e2c3433a3ae
equal deleted inserted replaced
38173:73d05e56ec86 38183:cb68e4923223
    29 #include "runtime/globals.hpp"
    29 #include "runtime/globals.hpp"
    30 
    30 
    31 template <typename T>
    31 template <typename T>
    32 class GrowableArray;
    32 class GrowableArray;
    33 
    33 
    34 class YoungList : public CHeapObj<mtGC> {
    34 class G1SurvivorRegions VALUE_OBJ_CLASS_SPEC {
    35 private:
    35 private:
    36   G1CollectedHeap* _g1h;
    36   GrowableArray<HeapRegion*>* _regions;
    37   GrowableArray<HeapRegion*>* _survivor_regions;
       
    38 
       
    39   HeapRegion* _head;
       
    40 
       
    41   uint        _length;
       
    42 
       
    43   void         empty_list(HeapRegion* list);
       
    44 
    37 
    45 public:
    38 public:
    46   YoungList(G1CollectedHeap* g1h);
    39   G1SurvivorRegions();
    47 
    40 
    48   void         push_region(HeapRegion* hr);
    41   void add(HeapRegion* hr);
    49   void         add_survivor_region(HeapRegion* hr);
       
    50 
    42 
    51   void         empty_list();
    43   void convert_to_eden();
    52   bool         is_empty() { return _length == 0; }
       
    53   uint         length() { return _length; }
       
    54   uint         eden_length() { return length() - survivor_length(); }
       
    55   uint         survivor_length();
       
    56 
    44 
    57   const GrowableArray<HeapRegion*>* survivor_regions() const { return _survivor_regions; }
    45   void clear();
    58 
    46 
    59   // Currently we do not keep track of the used byte sum for the
    47   uint length() const;
    60   // young list and the survivors and it'd be quite a lot of work to
    48 
    61   // do so. When we'll eventually replace the young list with
    49   const GrowableArray<HeapRegion*>* regions() const {
    62   // instances of HeapRegionLinkedList we'll get that for free. So,
    50     return _regions;
    63   // we'll report the more accurate information then.
       
    64   size_t       eden_used_bytes() {
       
    65     assert(length() >= survivor_length(), "invariant");
       
    66     return (size_t) eden_length() * HeapRegion::GrainBytes;
       
    67   }
    51   }
    68   size_t       survivor_used_bytes() {
    52 };
    69     return (size_t) survivor_length() * HeapRegion::GrainBytes;
       
    70   }
       
    71 
    53 
    72   // for development purposes
    54 class G1EdenRegions VALUE_OBJ_CLASS_SPEC {
    73   void reset_auxilary_lists();
    55 private:
    74   void clear() { _head = NULL; _length = 0; }
    56   int _length;
    75 
    57 
    76   void clear_survivors() {
    58 public:
    77     _survivor_regions->clear();
    59   G1EdenRegions() : _length(0) {}
    78   }
       
    79 
    60 
    80   HeapRegion* first_region() { return _head; }
    61   void add(HeapRegion* hr);
    81 
    62 
    82   // debugging
    63   void clear() { _length = 0; }
    83   bool          check_list_well_formed();
    64 
    84   bool          check_list_empty();
    65   uint length() const { return _length; }
    85   void          print();
       
    86 };
    66 };
    87 
    67 
    88 #endif // SHARE_VM_GC_G1_YOUNGLIST_HPP
    68 #endif // SHARE_VM_GC_G1_YOUNGLIST_HPP