< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Print this page
rev 57380 : 8234974: Shenandoah: Do concurrent roots even when no evacuation is necessary
rev 57381 : [mq]: JDK-8234974-changes.patch
*** 540,549 ****
--- 540,550 ----
if (is_update_refs_in_progress()) st->print("updating refs, ");
if (is_concurrent_traversal_in_progress()) st->print("traversal, ");
if (is_degenerated_gc_in_progress()) st->print("degenerated gc, ");
if (is_full_gc_in_progress()) st->print("full gc, ");
if (is_full_gc_move_in_progress()) st->print("full gc move, ");
+ if (is_concurrent_root_in_progress()) st->print("concurrent roots, ");
if (cancelled_gc()) {
st->print("cancelled");
} else {
st->print("not cancelled");
*** 1538,1563 ****
heuristics()->choose_collection_set(_collection_set);
_free_set->rebuild();
}
// If collection set has candidates, start evacuation.
// Otherwise, bypass the rest of the cycle.
if (!collection_set()->is_empty()) {
ShenandoahGCPhase init_evac(ShenandoahPhaseTimings::init_evac);
if (ShenandoahVerify) {
verifier()->verify_before_evacuation();
}
set_evacuation_in_progress(true);
// From here on, we need to update references.
set_has_forwarded_objects(true);
if (!is_degenerated_gc_in_progress()) {
- prepare_concurrent_roots();
- prepare_concurrent_unloading();
evacuate_and_update_roots();
}
if (ShenandoahPacing) {
pacer()->setup_for_evac();
--- 1539,1571 ----
heuristics()->choose_collection_set(_collection_set);
_free_set->rebuild();
}
+ if (!is_degenerated_gc_in_progress()) {
+ prepare_concurrent_roots();
+ prepare_concurrent_unloading();
+ }
+
// If collection set has candidates, start evacuation.
// Otherwise, bypass the rest of the cycle.
if (!collection_set()->is_empty()) {
ShenandoahGCPhase init_evac(ShenandoahPhaseTimings::init_evac);
if (ShenandoahVerify) {
verifier()->verify_before_evacuation();
}
+ if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
+ ShenandoahCodeRoots::prepare_concurrent_unloading();
+ }
+
set_evacuation_in_progress(true);
// From here on, we need to update references.
set_has_forwarded_objects(true);
if (!is_degenerated_gc_in_progress()) {
evacuate_and_update_roots();
}
if (ShenandoahPacing) {
pacer()->setup_for_evac();
*** 1650,1685 ****
AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
}
void work(uint worker_id) {
ShenandoahEvacOOMScope oom;
{
! // jni_roots and weak_roots are OopStorage backed roots, concurrent iteration
! // may race against OopStorage::release() calls.
! ShenandoahEvacUpdateOopStorageRootsClosure cl;
! _vm_roots.oops_do<ShenandoahEvacUpdateOopStorageRootsClosure>(&cl);
! _weak_roots.oops_do<ShenandoahEvacUpdateOopStorageRootsClosure>(&cl);
! }
!
! {
! ShenandoahEvacuateUpdateRootsClosure cl;
CLDToOopClosure clds(&cl, ClassLoaderData::_claim_strong);
_cld_roots.cld_do(&clds);
}
}
};
void ShenandoahHeap::op_roots() {
! if (is_evacuation_in_progress()) {
! if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
! _unloader.unload();
! }
!
if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
ShenandoahConcurrentRootsEvacUpdateTask task;
workers()->run_task(&task);
}
}
set_concurrent_root_in_progress(false);
}
--- 1658,1686 ----
AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
}
void work(uint worker_id) {
ShenandoahEvacOOMScope oom;
+ ShenandoahEvacUpdateCleanupRootsClosure cl;
{
! _vm_roots.oops_do<>(&cl);
! _weak_roots.oops_do<>(&cl);
CLDToOopClosure clds(&cl, ClassLoaderData::_claim_strong);
_cld_roots.cld_do(&clds);
}
}
};
void ShenandoahHeap::op_roots() {
! if (is_concurrent_root_in_progress()) {
if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
ShenandoahConcurrentRootsEvacUpdateTask task;
workers()->run_task(&task);
}
+ if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
+ _unloader.unload();
+ }
}
set_concurrent_root_in_progress(false);
}
*** 2233,2243 ****
}
void ShenandoahHeap::prepare_concurrent_unloading() {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
- ShenandoahCodeRoots::prepare_concurrent_unloading();
_unloader.prepare();
}
}
void ShenandoahHeap::finish_concurrent_unloading() {
--- 2234,2243 ----
< prev index next >