243
244 // Uncommit up to num_regions_to_remove regions that are completely free.
245 // Return the actual number of uncommitted regions.
246 uint shrink_by(uint num_regions_to_remove);
247
248 // Uncommit a number of regions starting at the specified index, which must be available,
249 // empty, and free.
250 void shrink_at(uint index, size_t num_regions);
251
252 void verify();
253
254 // Do some sanity checking.
255 void verify_optional() PRODUCT_RETURN;
256 };
257
258 // The HeapRegionClaimer is used during parallel iteration over heap regions,
259 // allowing workers to claim heap regions, gaining exclusive rights to these regions.
260 class HeapRegionClaimer : public StackObj {
261 uint _n_workers;
262 uint _n_regions;
263 uint* _claims;
264
265 static const uint Unclaimed = 0;
266 static const uint Claimed = 1;
267
268 public:
269 HeapRegionClaimer(uint n_workers);
270 ~HeapRegionClaimer();
271
272 inline uint n_regions() const {
273 return _n_regions;
274 }
275
276 // Calculate the starting region for given worker so
277 // that they do not all start from the same region.
278 uint start_region_for_worker(uint worker_id) const;
279
280 // Check if region has been claimed with this HRClaimer.
281 bool is_region_claimed(uint region_index) const;
282
283 // Claim the given region, returns true if successfully claimed.
284 bool claim_region(uint region_index);
285 };
286 #endif // SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP
287
|
243
244 // Uncommit up to num_regions_to_remove regions that are completely free.
245 // Return the actual number of uncommitted regions.
246 uint shrink_by(uint num_regions_to_remove);
247
248 // Uncommit a number of regions starting at the specified index, which must be available,
249 // empty, and free.
250 void shrink_at(uint index, size_t num_regions);
251
252 void verify();
253
254 // Do some sanity checking.
255 void verify_optional() PRODUCT_RETURN;
256 };
257
258 // The HeapRegionClaimer is used during parallel iteration over heap regions,
259 // allowing workers to claim heap regions, gaining exclusive rights to these regions.
260 class HeapRegionClaimer : public StackObj {
261 uint _n_workers;
262 uint _n_regions;
263 volatile uint* _claims;
264
265 static const uint Unclaimed = 0;
266 static const uint Claimed = 1;
267
268 public:
269 HeapRegionClaimer(uint n_workers);
270 ~HeapRegionClaimer();
271
272 inline uint n_regions() const {
273 return _n_regions;
274 }
275
276 // Calculate the starting region for given worker so
277 // that they do not all start from the same region.
278 uint start_region_for_worker(uint worker_id) const;
279
280 // Check if region has been claimed with this HRClaimer.
281 bool is_region_claimed(uint region_index) const;
282
283 // Claim the given region, returns true if successfully claimed.
284 bool claim_region(uint region_index);
285 };
286 #endif // SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP
|