src/share/vm/gc/g1/heapRegionManager.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/gc/g1/heapRegionManager.cpp	Tue Mar  8 15:19:58 2016
--- new/src/share/vm/gc/g1/heapRegionManager.cpp	Tue Mar  8 15:19:57 2016

*** 240,250 **** --- 240,262 ---- for (uint i = 0; i < len; i++) { if (!is_available(i)) { continue; } guarantee(at(i) != NULL, "Tried to access region %u that has a NULL HeapRegion*", i); - bool res = blk->doHeapRegion(at(i)); + } + } + + void HeapRegionManager::iterate(AbortableHeapRegionClosure* blk) const { + uint len = max_length(); + + for (uint i = 0; i < len; i++) { + if (!is_available(i)) { + continue; + } + guarantee(at(i) != NULL, "Tried to access region %u that has a NULL HeapRegion*", i); + bool res = blk->doHeapRegionAbortable(at(i)); if (res) { blk->incomplete(); return; } }
*** 353,363 **** --- 365,407 ---- } // OK, try to claim it if (!hrclaimer->claim_region(index)) { continue; } - bool res = blk->doHeapRegion(r); + } + } + + void HeapRegionManager::par_iterate(AbortableHeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const { + const uint start_index = hrclaimer->start_region_for_worker(worker_id); + + // Every worker will actually look at all regions, skipping over regions that + // are currently not committed. + // This also (potentially) iterates over regions newly allocated during GC. This + // is no problem except for some extra work. + const uint n_regions = hrclaimer->n_regions(); + for (uint count = 0; count < n_regions; count++) { + const uint index = (start_index + count) % n_regions; + assert(index < n_regions, "sanity"); + // Skip over unavailable regions + if (!is_available(index)) { + continue; + } + HeapRegion* r = _regions.get_by_index(index); + // We'll ignore regions already claimed. + // However, if the iteration is specified as concurrent, the values for + // is_starts_humongous and is_continues_humongous can not be trusted, + // and we should just blindly iterate over regions regardless of their + // humongous status. + if (hrclaimer->is_region_claimed(index)) { + continue; + } + // OK, try to claim it + if (!hrclaimer->claim_region(index)) { + continue; + } + bool res = blk->doHeapRegionAbortable(r); if (res) { return; } } }

src/share/vm/gc/g1/heapRegionManager.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File