< prev index next >

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

Print this page

        

@@ -61,22 +61,26 @@
   }
 
   // Returns the total number of collection set candidate old regions added.
   uint num_regions() { return _num_regions; }
 
-  uint cur_idx() const { return _front_idx; }
-
-  HeapRegion* at(uint idx) const {
+  // Return the candidate region at the cursor position to be considered for collection without
+  // removing it.
+  HeapRegion* peek_front() {
     HeapRegion* res = NULL;
-    if (idx < _num_regions) {
-      res = _regions[idx];
-      assert(res != NULL, "Unexpected NULL HeapRegion at index %u", idx);
+    if (_front_idx < _num_regions) {
+      res = _regions[_front_idx];
+      assert(res != NULL, "Unexpected NULL HeapRegion at index %u", _front_idx);
     }
     return res;
   }
 
-  void remove(uint num_regions);
+  // Remove the given region from the candidates set and move the cursor to the next one.
+  HeapRegion* pop_front();
+
+  // Add the given HeapRegion to the front of the collection set candidate set again.
+  void push_front(HeapRegion* hr);
 
   // Iterate over all remaining collection set candidate regions.
   void iterate(HeapRegionClosure* cl);
 
   // Return the number of candidate regions remaining.
< prev index next >