< prev index next >

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

Print this page
rev 54087 : imported patch 8218668-reorganize-collection-set


  46   // set candidates.
  47   size_t _remaining_reclaimable_bytes;
  48   // The index of the next candidate old region to be considered for
  49   // addition to the current collection set.
  50   uint _front_idx;
  51 
  52 public:
  53   G1CollectionSetCandidates(HeapRegion** regions, uint num_regions, size_t remaining_reclaimable_bytes) :
  54     _regions(regions),
  55     _num_regions(num_regions),
  56     _remaining_reclaimable_bytes(remaining_reclaimable_bytes),
  57     _front_idx(0) { }
  58 
  59   ~G1CollectionSetCandidates() {
  60     FREE_C_HEAP_ARRAY(HeapRegion*, _regions);
  61   }
  62 
  63   // Returns the total number of collection set candidate old regions added.
  64   uint num_regions() { return _num_regions; }
  65 
  66   // Return the candidate region at the cursor position to be considered for collection without
  67   // removing it.
  68   HeapRegion* peek_front() {
  69     HeapRegion* res = NULL;
  70     if (_front_idx < _num_regions) {
  71       res = _regions[_front_idx];
  72       assert(res != NULL, "Unexpected NULL HeapRegion at index %u", _front_idx);
  73     }
  74     return res;
  75   }
  76 
  77   // Remove the given region from the candidates set and move the cursor to the next one.
  78   HeapRegion* pop_front();
  79 
  80   // Add the given HeapRegion to the front of the collection set candidate set again.
  81   void push_front(HeapRegion* hr);
  82 
  83   // Iterate over all remaining collection set candidate regions.
  84   void iterate(HeapRegionClosure* cl);
  85 
  86   // Return the number of candidate regions remaining.
  87   uint num_remaining() { return _num_regions - _front_idx; }
  88 
  89   bool is_empty() { return num_remaining() == 0; }
  90 
  91   // Return the amount of reclaimable bytes that may be collected by the remaining
  92   // candidate regions.
  93   size_t remaining_reclaimable_bytes() { return _remaining_reclaimable_bytes; }
  94 
  95   void verify() const PRODUCT_RETURN;
  96 };
  97 
  98 #endif /* SHARE_GC_G1_G1COLLECTIONSETCANDIDATES_HPP */
  99 


  46   // set candidates.
  47   size_t _remaining_reclaimable_bytes;
  48   // The index of the next candidate old region to be considered for
  49   // addition to the current collection set.
  50   uint _front_idx;
  51 
  52 public:
  53   G1CollectionSetCandidates(HeapRegion** regions, uint num_regions, size_t remaining_reclaimable_bytes) :
  54     _regions(regions),
  55     _num_regions(num_regions),
  56     _remaining_reclaimable_bytes(remaining_reclaimable_bytes),
  57     _front_idx(0) { }
  58 
  59   ~G1CollectionSetCandidates() {
  60     FREE_C_HEAP_ARRAY(HeapRegion*, _regions);
  61   }
  62 
  63   // Returns the total number of collection set candidate old regions added.
  64   uint num_regions() { return _num_regions; }
  65 
  66   uint cur_idx() const { return _front_idx; }
  67 
  68   HeapRegion* at(uint idx) const {
  69     HeapRegion* res = NULL;
  70     if (idx < _num_regions) {
  71       res = _regions[idx];
  72       assert(res != NULL, "Unexpected NULL HeapRegion at index %u", idx);
  73     }
  74     return res;
  75   }
  76 
  77   void remove(uint num_regions);




  78 
  79   // Iterate over all remaining collection set candidate regions.
  80   void iterate(HeapRegionClosure* cl);
  81 
  82   // Return the number of candidate regions remaining.
  83   uint num_remaining() { return _num_regions - _front_idx; }
  84 
  85   bool is_empty() { return num_remaining() == 0; }
  86 
  87   // Return the amount of reclaimable bytes that may be collected by the remaining
  88   // candidate regions.
  89   size_t remaining_reclaimable_bytes() { return _remaining_reclaimable_bytes; }
  90 
  91   void verify() const PRODUCT_RETURN;
  92 };
  93 
  94 #endif /* SHARE_GC_G1_G1COLLECTIONSETCANDIDATES_HPP */
  95 
< prev index next >