mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8254103: Shenandoah: Move updating thread roots to concurrent phase
Reviewed-by: rkennke
This commit is contained in:
parent
7e82ba1ff0
commit
d036dca085
4 changed files with 45 additions and 2 deletions
|
@ -449,6 +449,10 @@ void ShenandoahControlThread::service_concurrent_normal_cycle(GCCause::Cause cau
|
||||||
heap->entry_updaterefs();
|
heap->entry_updaterefs();
|
||||||
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_updaterefs)) return;
|
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_updaterefs)) return;
|
||||||
|
|
||||||
|
// Concurrent update thread roots
|
||||||
|
heap->entry_update_thread_roots();
|
||||||
|
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_updaterefs)) return;
|
||||||
|
|
||||||
heap->vmop_entry_final_updaterefs();
|
heap->vmop_entry_final_updaterefs();
|
||||||
|
|
||||||
// Update references freed up collection set, kick the cleanup to reclaim the space.
|
// Update references freed up collection set, kick the cleanup to reclaim the space.
|
||||||
|
|
|
@ -1806,6 +1806,31 @@ void ShenandoahHeap::op_conc_evac() {
|
||||||
workers()->run_task(&task);
|
workers()->run_task(&task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ShenandoahUpdateThreadClosure : public HandshakeClosure {
|
||||||
|
private:
|
||||||
|
ShenandoahUpdateRefsClosure _cl;
|
||||||
|
public:
|
||||||
|
ShenandoahUpdateThreadClosure();
|
||||||
|
void do_thread(Thread* thread);
|
||||||
|
};
|
||||||
|
|
||||||
|
ShenandoahUpdateThreadClosure::ShenandoahUpdateThreadClosure() :
|
||||||
|
HandshakeClosure("Shenandoah Update Thread Roots") {
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShenandoahUpdateThreadClosure::do_thread(Thread* thread) {
|
||||||
|
if (thread->is_Java_thread()) {
|
||||||
|
JavaThread* jt = thread->as_Java_thread();
|
||||||
|
ResourceMark rm;
|
||||||
|
jt->oops_do(&_cl, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShenandoahHeap::op_update_thread_roots() {
|
||||||
|
ShenandoahUpdateThreadClosure cl;
|
||||||
|
Handshake::execute(&cl);
|
||||||
|
}
|
||||||
|
|
||||||
void ShenandoahHeap::op_stw_evac() {
|
void ShenandoahHeap::op_stw_evac() {
|
||||||
ShenandoahEvacuationTask task(this, _collection_set, false);
|
ShenandoahEvacuationTask task(this, _collection_set, false);
|
||||||
workers()->run_task(&task);
|
workers()->run_task(&task);
|
||||||
|
@ -2735,8 +2760,6 @@ void ShenandoahHeap::op_final_updaterefs() {
|
||||||
|
|
||||||
if (is_degenerated_gc_in_progress()) {
|
if (is_degenerated_gc_in_progress()) {
|
||||||
concurrent_mark()->update_roots(ShenandoahPhaseTimings::degen_gc_update_roots);
|
concurrent_mark()->update_roots(ShenandoahPhaseTimings::degen_gc_update_roots);
|
||||||
} else {
|
|
||||||
concurrent_mark()->update_thread_roots(ShenandoahPhaseTimings::final_update_refs_roots);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has to be done before cset is clear
|
// Has to be done before cset is clear
|
||||||
|
@ -3018,6 +3041,19 @@ void ShenandoahHeap::entry_evac() {
|
||||||
op_conc_evac();
|
op_conc_evac();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShenandoahHeap::entry_update_thread_roots() {
|
||||||
|
TraceCollectorStats tcs(monitoring_support()->concurrent_collection_counters());
|
||||||
|
|
||||||
|
static const char* msg = "Concurrent update thread roots";
|
||||||
|
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_update_thread_roots);
|
||||||
|
EventMark em("%s", msg);
|
||||||
|
|
||||||
|
// No workers used in this phase, no setup required
|
||||||
|
try_inject_alloc_failure();
|
||||||
|
op_update_thread_roots();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ShenandoahHeap::entry_updaterefs() {
|
void ShenandoahHeap::entry_updaterefs() {
|
||||||
static const char* msg = "Concurrent update references";
|
static const char* msg = "Concurrent update references";
|
||||||
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_update_refs);
|
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_update_refs);
|
||||||
|
|
|
@ -396,6 +396,7 @@ public:
|
||||||
void entry_cleanup_early();
|
void entry_cleanup_early();
|
||||||
void entry_rendezvous_roots();
|
void entry_rendezvous_roots();
|
||||||
void entry_evac();
|
void entry_evac();
|
||||||
|
void entry_update_thread_roots();
|
||||||
void entry_updaterefs();
|
void entry_updaterefs();
|
||||||
void entry_cleanup_complete();
|
void entry_cleanup_complete();
|
||||||
void entry_uncommit(double shrink_before, size_t shrink_until);
|
void entry_uncommit(double shrink_before, size_t shrink_until);
|
||||||
|
@ -421,6 +422,7 @@ private:
|
||||||
void op_rendezvous_roots();
|
void op_rendezvous_roots();
|
||||||
void op_conc_evac();
|
void op_conc_evac();
|
||||||
void op_stw_evac();
|
void op_stw_evac();
|
||||||
|
void op_update_thread_roots();
|
||||||
void op_updaterefs();
|
void op_updaterefs();
|
||||||
void op_cleanup_complete();
|
void op_cleanup_complete();
|
||||||
void op_uncommit(double shrink_before, size_t shrink_until);
|
void op_uncommit(double shrink_before, size_t shrink_until);
|
||||||
|
|
|
@ -106,6 +106,7 @@ class outputStream;
|
||||||
f(init_update_refs, "Pause Init Update Refs (N)") \
|
f(init_update_refs, "Pause Init Update Refs (N)") \
|
||||||
f(init_update_refs_manage_gclabs, " Manage GCLABs") \
|
f(init_update_refs_manage_gclabs, " Manage GCLABs") \
|
||||||
\
|
\
|
||||||
|
f(conc_update_thread_roots, "Concurrent Update Thread Roots") \
|
||||||
f(conc_update_refs, "Concurrent Update Refs") \
|
f(conc_update_refs, "Concurrent Update Refs") \
|
||||||
\
|
\
|
||||||
f(final_update_refs_gross, "Pause Final Update Refs (G)") \
|
f(final_update_refs_gross, "Pause Final Update Refs (G)") \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue