--- old/src/hotspot/share/gc/g1/heapRegionSet.cpp 2018-11-19 14:07:30.470998400 -0800 +++ new/src/hotspot/share/gc/g1/heapRegionSet.cpp 2018-11-19 14:07:29.489038200 -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.