src/hotspot/share/gc/g1/heapRegionSet.cpp
changeset 53116 bb03098c4dde
parent 51496 bf6b66fa8bdf
child 59062 6530de931b8e
--- a/src/hotspot/share/gc/g1/heapRegionSet.cpp	Fri Dec 21 18:26:55 2018 +0000
+++ b/src/hotspot/share/gc/g1/heapRegionSet.cpp	Fri Dec 21 08:18:59 2018 -0800
@@ -234,6 +234,21 @@
   verify_optional();
 }
 
+uint FreeRegionList::num_of_regions_in_range(uint start, uint end) const {
+  HeapRegion* cur = _head;
+  uint num = 0;
+  while (cur != NULL) {
+    uint index = cur->hrm_index();
+    if (index > end) {
+      break;
+    } else if (index >= start) {
+      num++;
+    }
+    cur = cur->next();
+  }
+  return num;
+}
+
 void FreeRegionList::verify() {
   // See comment in HeapRegionSetBase::verify() about MT safety and
   // verification.