219 220 // Find a contiguous set of empty regions of length num. Returns the start index of 221 // that set, or G1_NO_HRM_INDEX. 222 uint find_contiguous_only_empty(size_t num) { return find_contiguous(num, true); } 223 // Find a contiguous set of empty or unavailable regions of length num. Returns the 224 // start index of that set, or G1_NO_HRM_INDEX. 225 uint find_contiguous_empty_or_unavailable(size_t num) { return find_contiguous(num, false); } 226 227 HeapRegion* next_region_in_heap(const HeapRegion* r) const; 228 229 // Find the highest free or uncommitted region in the reserved heap, 230 // and if uncommitted, commit it. If none are available, return G1_NO_HRM_INDEX. 231 // Set the 'expanded' boolean true if a new region was committed. 232 uint find_highest_free(bool* expanded); 233 234 // Allocate the regions that contain the address range specified, committing the 235 // regions if necessary. Return false if any of the regions is already committed 236 // and not free, and return the number of regions newly committed in commit_count. 237 bool allocate_containing_regions(MemRegion range, size_t* commit_count, WorkGang* pretouch_workers); 238 239 // Apply blk->do_heap_region() on all committed regions in address order, 240 // terminating the iteration early if do_heap_region() returns true. 241 void iterate(HeapRegionClosure* blk) const; 242 243 void par_iterate(HeapRegionClosure* blk, HeapRegionClaimer* hrclaimer, const uint start_index) const; 244 245 // Uncommit up to num_regions_to_remove regions that are completely free. 246 // Return the actual number of uncommitted regions. 247 uint shrink_by(uint num_regions_to_remove); 248 249 // Uncommit a number of regions starting at the specified index, which must be available, 250 // empty, and free. 251 void shrink_at(uint index, size_t num_regions); 252 253 void verify(); 254 255 // Do some sanity checking. 256 void verify_optional() PRODUCT_RETURN; 257 }; 258 259 // The HeapRegionClaimer is used during parallel iteration over heap regions, 260 // allowing workers to claim heap regions, gaining exclusive rights to these regions. | 219 220 // Find a contiguous set of empty regions of length num. Returns the start index of 221 // that set, or G1_NO_HRM_INDEX. 222 uint find_contiguous_only_empty(size_t num) { return find_contiguous(num, true); } 223 // Find a contiguous set of empty or unavailable regions of length num. Returns the 224 // start index of that set, or G1_NO_HRM_INDEX. 225 uint find_contiguous_empty_or_unavailable(size_t num) { return find_contiguous(num, false); } 226 227 HeapRegion* next_region_in_heap(const HeapRegion* r) const; 228 229 // Find the highest free or uncommitted region in the reserved heap, 230 // and if uncommitted, commit it. If none are available, return G1_NO_HRM_INDEX. 231 // Set the 'expanded' boolean true if a new region was committed. 232 uint find_highest_free(bool* expanded); 233 234 // Allocate the regions that contain the address range specified, committing the 235 // regions if necessary. Return false if any of the regions is already committed 236 // and not free, and return the number of regions newly committed in commit_count. 237 bool allocate_containing_regions(MemRegion range, size_t* commit_count, WorkGang* pretouch_workers); 238 239 // Apply blk->doHeapRegion() on all committed regions in address order, 240 // terminating the iteration early if doHeapRegion() returns true. 241 void iterate(HeapRegionClosure* blk) const; 242 243 void par_iterate(HeapRegionClosure* blk, HeapRegionClaimer* hrclaimer, const uint start_index) const; 244 245 // Uncommit up to num_regions_to_remove regions that are completely free. 246 // Return the actual number of uncommitted regions. 247 uint shrink_by(uint num_regions_to_remove); 248 249 // Uncommit a number of regions starting at the specified index, which must be available, 250 // empty, and free. 251 void shrink_at(uint index, size_t num_regions); 252 253 void verify(); 254 255 // Do some sanity checking. 256 void verify_optional() PRODUCT_RETURN; 257 }; 258 259 // The HeapRegionClaimer is used during parallel iteration over heap regions, 260 // allowing workers to claim heap regions, gaining exclusive rights to these regions. |