--- old/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp 2020-05-03 15:31:17.845998168 +0200 +++ new/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp 2020-05-03 15:31:17.609996998 +0200 @@ -110,8 +110,9 @@ bool is_page_committed(size_t page_idx) { size_t region = page_idx * _regions_per_page; - // At least one bit must be set if the page is committed. - return _region_commit_map.count_one_bits(region, region + _regions_per_page) > 0; + size_t region_limit = region + _regions_per_page; + // Committed if there is a bit set in the range. + return _region_commit_map.get_next_one_offset(region, region_limit) != region_limit; } void numa_request_on_node(size_t page_idx) { @@ -137,8 +138,9 @@ } virtual void commit_regions(uint start_idx, size_t num_regions, WorkGang* pretouch_gang) { - assert(_region_commit_map.count_one_bits(start_idx, start_idx + num_regions) == 0, - "Should be no commited regions in the range [%u, " SIZE_FORMAT ")", + assert(num_regions > 0, "Must commit at least one region"); + assert(_region_commit_map.get_next_one_offset(start_idx, start_idx + num_regions) == start_idx + num_regions, + "Should be no committed regions in the range [%u, " SIZE_FORMAT ")", start_idx, start_idx + num_regions); size_t const NoPage = ~(size_t)0; @@ -182,8 +184,9 @@ } virtual void uncommit_regions(uint start_idx, size_t num_regions) { - assert(_region_commit_map.count_one_bits(start_idx, start_idx + num_regions) == num_regions, - "Should only be commited regions in the range [%u, " SIZE_FORMAT ")", + assert(num_regions > 0, "Must uncommit at least one region"); + assert(_region_commit_map.get_next_zero_offset(start_idx, start_idx + num_regions) == start_idx + num_regions, + "Should only be committed regions in the range [%u, " SIZE_FORMAT ")", start_idx, start_idx + num_regions); size_t start_page = region_idx_to_page_idx(start_idx);