@@ -1806,6 +1806,31 @@ void ShenandoahHeap::op_conc_evac() {
18061806 workers ()->run_task (&task);
18071807}
18081808
1809+ class ShenandoahUpdateThreadClosure : public HandshakeClosure {
1810+ private:
1811+ ShenandoahUpdateRefsClosure _cl;
1812+ public:
1813+ ShenandoahUpdateThreadClosure ();
1814+ void do_thread (Thread* thread);
1815+ };
1816+
1817+ ShenandoahUpdateThreadClosure::ShenandoahUpdateThreadClosure () :
1818+ HandshakeClosure(" Shenandoah Update Thread Roots" ) {
1819+ }
1820+
1821+ void ShenandoahUpdateThreadClosure::do_thread (Thread* thread) {
1822+ if (thread->is_Java_thread ()) {
1823+ JavaThread* jt = thread->as_Java_thread ();
1824+ ResourceMark rm;
1825+ jt->oops_do (&_cl, NULL );
1826+ }
1827+ }
1828+
1829+ void ShenandoahHeap::op_update_thread_roots () {
1830+ ShenandoahUpdateThreadClosure cl;
1831+ Handshake::execute (&cl);
1832+ }
1833+
18091834void ShenandoahHeap::op_stw_evac () {
18101835 ShenandoahEvacuationTask task (this , _collection_set, false );
18111836 workers ()->run_task (&task);
@@ -2735,8 +2760,6 @@ void ShenandoahHeap::op_final_updaterefs() {
27352760
27362761 if (is_degenerated_gc_in_progress ()) {
27372762 concurrent_mark ()->update_roots (ShenandoahPhaseTimings::degen_gc_update_roots);
2738- } else {
2739- concurrent_mark ()->update_thread_roots (ShenandoahPhaseTimings::final_update_refs_roots);
27402763 }
27412764
27422765 // Has to be done before cset is clear
@@ -3018,6 +3041,19 @@ void ShenandoahHeap::entry_evac() {
30183041 op_conc_evac ();
30193042}
30203043
3044+ void ShenandoahHeap::entry_update_thread_roots () {
3045+ TraceCollectorStats tcs (monitoring_support ()->concurrent_collection_counters ());
3046+
3047+ static const char * msg = " Concurrent update thread roots" ;
3048+ ShenandoahConcurrentPhase gc_phase (msg, ShenandoahPhaseTimings::conc_update_thread_roots);
3049+ EventMark em (" %s" , msg);
3050+
3051+ // No workers used in this phase, no setup required
3052+ try_inject_alloc_failure ();
3053+ op_update_thread_roots ();
3054+ }
3055+
3056+
30213057void ShenandoahHeap::entry_updaterefs () {
30223058 static const char * msg = " Concurrent update references" ;
30233059 ShenandoahConcurrentPhase gc_phase (msg, ShenandoahPhaseTimings::conc_update_refs);
0 commit comments