< prev index next >

src/share/vm/gc/shenandoah/shenandoahPartialGC.cpp

Print this page




 209   for (uint to_idx = 0; to_idx < num_regions; to_idx++) {
 210     ShenandoahHeapRegion* region = regions->get(to_idx);
 211     if (! region->is_humongous() &&
 212         ! region->is_pinned() &&
 213         ! region->is_root() &&
 214         ! _heap->in_collection_set(region)) {
 215 
 216       free_set->add_region(region);
 217     }
 218   }
 219   log_debug(gc, ergo)("got "SIZE_FORMAT" cset regions", collection_set->count());
 220   log_debug(gc, ergo)("got "SIZE_FORMAT" root regions", _root_regions->count());
 221 }
 222 
 223 void ShenandoahPartialGC::do_partial_collection() {
 224 
 225   _heap->gc_timer()->register_gc_start();
 226   {
 227     GCTraceTime(Info, gc) time("Pause Partial", _heap->gc_timer(), GCCause::_no_gc, true);
 228 






 229     COMPILER2_PRESENT(DerivedPointerTable::clear());
 230 
 231     {
 232       ClassLoaderDataGraph::clear_claimed_marks();
 233       ShenandoahRootProcessor rp(_heap, _heap->workers()->active_workers());
 234       ShenandoahPartialCollectionTask partial_task(&rp, _root_regions);
 235       _heap->workers()->run_task(&partial_task);
 236     }
 237 
 238     COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
 239 
 240     if (! _heap->cancelled_concgc()) {






 241       ShenandoahHeap::ShenandoahHeapLock heap_lock(_heap);
 242       uint num_cset = _heap->collection_set()->count();
 243       for (uint i = 0; i < num_cset; i++) {
 244         ShenandoahHeapRegion* r = _heap->collection_set()->get(i);
 245         _heap->decrease_used(r->used());
 246         r->recycle();
 247         _heap->free_regions()->add_region(r);
 248       }
 249 
 250       reset();
 251     }
 252   }
 253   _heap->gc_timer()->register_gc_end();
 254 }
 255 
 256 void ShenandoahPartialGC::reset() {
 257   _heap->collection_set()->clear();
 258   _heap->clear_cset_fast_test();
 259   _root_regions->clear();
 260 }




 209   for (uint to_idx = 0; to_idx < num_regions; to_idx++) {
 210     ShenandoahHeapRegion* region = regions->get(to_idx);
 211     if (! region->is_humongous() &&
 212         ! region->is_pinned() &&
 213         ! region->is_root() &&
 214         ! _heap->in_collection_set(region)) {
 215 
 216       free_set->add_region(region);
 217     }
 218   }
 219   log_debug(gc, ergo)("got "SIZE_FORMAT" cset regions", collection_set->count());
 220   log_debug(gc, ergo)("got "SIZE_FORMAT" root regions", _root_regions->count());
 221 }
 222 
 223 void ShenandoahPartialGC::do_partial_collection() {
 224 
 225   _heap->gc_timer()->register_gc_start();
 226   {
 227     GCTraceTime(Info, gc) time("Pause Partial", _heap->gc_timer(), GCCause::_no_gc, true);
 228 
 229     if (ShenandoahVerify || VerifyShenandoahMatrix) {
 230       log_debug(gc, ergo)("Verifying before partial collection");
 231       _heap->verify_heap_reachable_at_safepoint();
 232       log_debug(gc, ergo)("Verification passed");
 233     }
 234 
 235     COMPILER2_PRESENT(DerivedPointerTable::clear());
 236 
 237     {
 238       ClassLoaderDataGraph::clear_claimed_marks();
 239       ShenandoahRootProcessor rp(_heap, _heap->workers()->active_workers());
 240       ShenandoahPartialCollectionTask partial_task(&rp, _root_regions);
 241       _heap->workers()->run_task(&partial_task);
 242     }
 243 
 244     COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
 245 
 246     if (! _heap->cancelled_concgc()) {
 247       if (ShenandoahVerify || VerifyShenandoahMatrix) {
 248         log_debug(gc, ergo)("Verifying after partial collection");
 249         _heap->verify_heap_reachable_at_safepoint();
 250         log_debug(gc, ergo)("Verification passed");
 251       }
 252 
 253       ShenandoahHeap::ShenandoahHeapLock heap_lock(_heap);
 254       uint num_cset = _heap->collection_set()->count();
 255       for (uint i = 0; i < num_cset; i++) {
 256         ShenandoahHeapRegion* r = _heap->collection_set()->get(i);
 257         _heap->decrease_used(r->used());
 258         r->recycle();
 259         _heap->free_regions()->add_region(r);
 260       }
 261 
 262       reset();
 263     }
 264   }
 265   _heap->gc_timer()->register_gc_end();
 266 }
 267 
 268 void ShenandoahPartialGC::reset() {
 269   _heap->collection_set()->clear();
 270   _heap->clear_cset_fast_test();
 271   _root_regions->clear();
 272 }


< prev index next >