< prev index next >

src/share/vm/gc/g1/collectionSetChooser.hpp

Print this page




  56   // Keeps track of the start of the next array chunk to be claimed by
  57   // parallel GC workers.
  58   uint _first_par_unreserved_idx;
  59 
  60   // If a region has more live bytes than this threshold, it will not
  61   // be added to the CSet chooser and will not be a candidate for
  62   // collection.
  63   size_t _region_live_threshold_bytes;
  64 
  65   // The sum of reclaimable bytes over all the regions in the CSet chooser.
  66   size_t _remaining_reclaimable_bytes;
  67 
  68 public:
  69 
  70   // Return the current candidate region to be considered for
  71   // collection without removing it from the CSet chooser.
  72   HeapRegion* peek() {
  73     HeapRegion* res = NULL;
  74     if (_front < _end) {
  75       res = regions_at(_front);
  76       assert(res != NULL,
  77              err_msg("Unexpected NULL hr in _regions at index %u",
  78                      _front));
  79     }
  80     return res;
  81   }
  82 
  83   // Remove the given region from the CSet chooser and move to the
  84   // next one.
  85   HeapRegion* pop() {
  86     HeapRegion* hr = regions_at(_front);
  87     assert(hr != NULL, "pre-condition");
  88     assert(_front < _end, "pre-condition");
  89     regions_at_put(_front, NULL);
  90     assert(hr->reclaimable_bytes() <= _remaining_reclaimable_bytes,
  91            err_msg("remaining reclaimable bytes inconsistent "
  92                    "from region: " SIZE_FORMAT " remaining: " SIZE_FORMAT,
  93                    hr->reclaimable_bytes(), _remaining_reclaimable_bytes));
  94     _remaining_reclaimable_bytes -= hr->reclaimable_bytes();
  95     _front += 1;
  96     return hr;
  97   }
  98 
  99   void push(HeapRegion* hr);
 100 
 101   CollectionSetChooser();
 102 
 103   void sort_regions();
 104 
 105   // Determine whether to add the given region to the CSet chooser or
 106   // not. Currently, we skip pinned regions and regions whose live
 107   // bytes are over the threshold. Humongous regions may be reclaimed during cleanup.
 108   bool should_add(HeapRegion* hr) {
 109     assert(hr->is_marked(), "pre-condition");
 110     assert(!hr->is_young(), "should never consider young regions");
 111     return !hr->is_pinned() &&
 112             hr->live_bytes() < _region_live_threshold_bytes;
 113   }




  56   // Keeps track of the start of the next array chunk to be claimed by
  57   // parallel GC workers.
  58   uint _first_par_unreserved_idx;
  59 
  60   // If a region has more live bytes than this threshold, it will not
  61   // be added to the CSet chooser and will not be a candidate for
  62   // collection.
  63   size_t _region_live_threshold_bytes;
  64 
  65   // The sum of reclaimable bytes over all the regions in the CSet chooser.
  66   size_t _remaining_reclaimable_bytes;
  67 
  68 public:
  69 
  70   // Return the current candidate region to be considered for
  71   // collection without removing it from the CSet chooser.
  72   HeapRegion* peek() {
  73     HeapRegion* res = NULL;
  74     if (_front < _end) {
  75       res = regions_at(_front);
  76       assert(res != NULL, "Unexpected NULL hr in _regions at index %u", _front);


  77     }
  78     return res;
  79   }
  80 
  81   // Remove the given region from the CSet chooser and move to the
  82   // next one.
  83   HeapRegion* pop() {
  84     HeapRegion* hr = regions_at(_front);
  85     assert(hr != NULL, "pre-condition");
  86     assert(_front < _end, "pre-condition");
  87     regions_at_put(_front, NULL);
  88     assert(hr->reclaimable_bytes() <= _remaining_reclaimable_bytes,
  89            "remaining reclaimable bytes inconsistent "
  90            "from region: " SIZE_FORMAT " remaining: " SIZE_FORMAT,
  91            hr->reclaimable_bytes(), _remaining_reclaimable_bytes);
  92     _remaining_reclaimable_bytes -= hr->reclaimable_bytes();
  93     _front += 1;
  94     return hr;
  95   }
  96 
  97   void push(HeapRegion* hr);
  98 
  99   CollectionSetChooser();
 100 
 101   void sort_regions();
 102 
 103   // Determine whether to add the given region to the CSet chooser or
 104   // not. Currently, we skip pinned regions and regions whose live
 105   // bytes are over the threshold. Humongous regions may be reclaimed during cleanup.
 106   bool should_add(HeapRegion* hr) {
 107     assert(hr->is_marked(), "pre-condition");
 108     assert(!hr->is_young(), "should never consider young regions");
 109     return !hr->is_pinned() &&
 110             hr->live_bytes() < _region_live_threshold_bytes;
 111   }


< prev index next >