< prev index next >

src/share/vm/gc_implementation/g1/heapRegionManager.cpp

Print this page
rev 7793 : 8073315: Enable gcc -Wtype-limits and fix upcoming issues.


 253 #ifdef ASSERT
 254   for (uint i = *res_idx; i < (*res_idx + num_regions); i++) {
 255     assert(!is_available(i), "just checking");
 256   }
 257   assert(cur == max_length() || num_regions == 0 || is_available(cur),
 258          err_msg("The region at the current position %u must be available or at the end of the heap.", cur));
 259 #endif
 260   return num_regions;
 261 }
 262 
 263 void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const {
 264   const uint start_index = hrclaimer->start_region_for_worker(worker_id);
 265 
 266   // Every worker will actually look at all regions, skipping over regions that
 267   // are currently not committed.
 268   // This also (potentially) iterates over regions newly allocated during GC. This
 269   // is no problem except for some extra work.
 270   const uint n_regions = hrclaimer->n_regions();
 271   for (uint count = 0; count < n_regions; count++) {
 272     const uint index = (start_index + count) % n_regions;
 273     assert(0 <= index && index < n_regions, "sanity");
 274     // Skip over unavailable regions
 275     if (!is_available(index)) {
 276       continue;
 277     }
 278     HeapRegion* r = _regions.get_by_index(index);
 279     // We'll ignore "continues humongous" regions (we'll process them
 280     // when we come across their corresponding "start humongous"
 281     // region) and regions already claimed.
 282     // However, if the iteration is specified as concurrent, the values for
 283     // is_starts_humongous and is_continues_humongous can not be trusted,
 284     // and we should just blindly iterate over regions regardless of their
 285     // humongous status.
 286     if (hrclaimer->is_region_claimed(index) || (!concurrent && r->is_continues_humongous())) {
 287       continue;
 288     }
 289     // OK, try to claim it
 290     if (!hrclaimer->claim_region(index)) {
 291       continue;
 292     }
 293     // Success!




 253 #ifdef ASSERT
 254   for (uint i = *res_idx; i < (*res_idx + num_regions); i++) {
 255     assert(!is_available(i), "just checking");
 256   }
 257   assert(cur == max_length() || num_regions == 0 || is_available(cur),
 258          err_msg("The region at the current position %u must be available or at the end of the heap.", cur));
 259 #endif
 260   return num_regions;
 261 }
 262 
 263 void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const {
 264   const uint start_index = hrclaimer->start_region_for_worker(worker_id);
 265 
 266   // Every worker will actually look at all regions, skipping over regions that
 267   // are currently not committed.
 268   // This also (potentially) iterates over regions newly allocated during GC. This
 269   // is no problem except for some extra work.
 270   const uint n_regions = hrclaimer->n_regions();
 271   for (uint count = 0; count < n_regions; count++) {
 272     const uint index = (start_index + count) % n_regions;
 273     assert(index < n_regions, "sanity");
 274     // Skip over unavailable regions
 275     if (!is_available(index)) {
 276       continue;
 277     }
 278     HeapRegion* r = _regions.get_by_index(index);
 279     // We'll ignore "continues humongous" regions (we'll process them
 280     // when we come across their corresponding "start humongous"
 281     // region) and regions already claimed.
 282     // However, if the iteration is specified as concurrent, the values for
 283     // is_starts_humongous and is_continues_humongous can not be trusted,
 284     // and we should just blindly iterate over regions regardless of their
 285     // humongous status.
 286     if (hrclaimer->is_region_claimed(index) || (!concurrent && r->is_continues_humongous())) {
 287       continue;
 288     }
 289     // OK, try to claim it
 290     if (!hrclaimer->claim_region(index)) {
 291       continue;
 292     }
 293     // Success!


< prev index next >