--- old/src/share/vm/gc_implementation/g1/heapRegion.cpp 2014-07-10 11:11:37.718969058 +0200 +++ new/src/share/vm/gc_implementation/g1/heapRegion.cpp 2014-07-10 11:11:37.638966743 +0200 @@ -381,18 +381,7 @@ } CompactibleSpace* HeapRegion::next_compaction_space() const { - // We're not using an iterator given that it will wrap around when - // it reaches the last region and this is not what we want here. - G1CollectedHeap* g1h = G1CollectedHeap::heap(); - uint index = hrs_index() + 1; - while (index < g1h->n_regions()) { - HeapRegion* hr = g1h->region_at(index); - if (!hr->isHumongous()) { - return hr; - } - index += 1; - } - return NULL; + return G1CollectedHeap::heap()->next_compaction_region(this); } void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark,