224 // Find the highest free or uncommitted region in the reserved heap,
225 // and if uncommitted, commit it. If none are available, return G1_NO_HRM_INDEX.
226 // Set the 'expanded' boolean true if a new region was committed.
227 uint find_highest_free(bool* expanded);
228
229 // Allocate the regions that contain the address range specified, committing the
230 // regions if necessary. Return false if any of the regions is already committed
231 // and not free, and return the number of regions newly committed in commit_count.
232 bool allocate_containing_regions(MemRegion range, size_t* commit_count);
233
234 // Apply blk->doHeapRegion() on all committed regions in address order,
235 // terminating the iteration early if doHeapRegion() returns true.
236 void iterate(HeapRegionClosure* blk) const;
237
238 void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const;
239
240 // Uncommit up to num_regions_to_remove regions that are completely free.
241 // Return the actual number of uncommitted regions.
242 uint shrink_by(uint num_regions_to_remove);
243
244 void verify();
245
246 // Do some sanity checking.
247 void verify_optional() PRODUCT_RETURN;
248 };
249
250 // The HeapRegionClaimer is used during parallel iteration over heap regions,
251 // allowing workers to claim heap regions, gaining exclusive rights to these regions.
252 class HeapRegionClaimer : public StackObj {
253 uint _n_workers;
254 uint _n_regions;
255 uint* _claims;
256
257 static const uint Unclaimed = 0;
258 static const uint Claimed = 1;
259
260 public:
261 HeapRegionClaimer(uint n_workers);
262 ~HeapRegionClaimer();
263
|
224 // Find the highest free or uncommitted region in the reserved heap,
225 // and if uncommitted, commit it. If none are available, return G1_NO_HRM_INDEX.
226 // Set the 'expanded' boolean true if a new region was committed.
227 uint find_highest_free(bool* expanded);
228
229 // Allocate the regions that contain the address range specified, committing the
230 // regions if necessary. Return false if any of the regions is already committed
231 // and not free, and return the number of regions newly committed in commit_count.
232 bool allocate_containing_regions(MemRegion range, size_t* commit_count);
233
234 // Apply blk->doHeapRegion() on all committed regions in address order,
235 // terminating the iteration early if doHeapRegion() returns true.
236 void iterate(HeapRegionClosure* blk) const;
237
238 void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const;
239
240 // Uncommit up to num_regions_to_remove regions that are completely free.
241 // Return the actual number of uncommitted regions.
242 uint shrink_by(uint num_regions_to_remove);
243
244 // Uncommit the region at the specified index, which must be available and free.
245 void shrink_at(uint index);
246
247 void verify();
248
249 // Do some sanity checking.
250 void verify_optional() PRODUCT_RETURN;
251 };
252
253 // The HeapRegionClaimer is used during parallel iteration over heap regions,
254 // allowing workers to claim heap regions, gaining exclusive rights to these regions.
255 class HeapRegionClaimer : public StackObj {
256 uint _n_workers;
257 uint _n_regions;
258 uint* _claims;
259
260 static const uint Unclaimed = 0;
261 static const uint Claimed = 1;
262
263 public:
264 HeapRegionClaimer(uint n_workers);
265 ~HeapRegionClaimer();
266
|