< 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
@@ -540,10 +540,11 @@
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,10 +1539,15 @@
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);
@@ -1552,12 +1558,13 @@
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();
+ if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
+ ShenandoahCodeRoots::arm_nmethods();
+ }
evacuate_and_update_roots();
}
if (ShenandoahPacing) {
pacer()->setup_for_evac();
@@ -1667,11 +1674,11 @@
}
}
};
void ShenandoahHeap::op_roots() {
- if (is_evacuation_in_progress()) {
+ if (is_concurrent_root_in_progress()) {
if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
_unloader.unload();
}
if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
@@ -2233,11 +2240,10 @@
}
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() {
< prev index next >