< prev index next > src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Print this page
class ShenandoahGCStatePropagatorHandshakeClosure : public HandshakeClosure {
public:
explicit ShenandoahGCStatePropagatorHandshakeClosure(char gc_state) :
HandshakeClosure("Shenandoah GC State Change"),
- _gc_state(gc_state) {}
+ _gc_state(gc_state), _gc_state_fast(ShenandoahThreadLocalData::compute_gc_state_fast(gc_state)) {}
void do_thread(Thread* thread) override {
- ShenandoahThreadLocalData::set_gc_state(thread, _gc_state);
+ ShenandoahThreadLocalData::set_gc_state(thread, _gc_state, _gc_state_fast);
}
private:
char _gc_state;
+ char _gc_state_fast;
};
class ShenandoahPrepareForUpdateRefsHandshakeClosure : public HandshakeClosure {
public:
explicit ShenandoahPrepareForUpdateRefsHandshakeClosure(char gc_state) :
ShenandoahRetireGCLABClosure _retire;
ShenandoahGCStatePropagatorHandshakeClosure _propagator;
};
void ShenandoahHeap::evacuate_collection_set(ShenandoahGeneration* generation, bool concurrent) {
+ if (concurrent && ShenandoahWeakRootsEarly) {
+ // Turn weak roots off now, so that weak barriers do not go slow.
+ {
+ MutexLocker lock(Threads_lock);
+ set_gc_state_concurrent(WEAK_ROOTS, false);
+ }
+
+ ShenandoahGCStatePropagatorHandshakeClosure propagate_gc_state(_gc_state.raw_value());
+ Threads::non_java_threads_do(&propagate_gc_state);
+ Handshake::execute(&propagate_gc_state);
+ }
+
assert(generation->is_global(), "Only global generation expected here");
ShenandoahEvacuationTask task(this, _collection_set, concurrent);
workers()->run_task(&task);
}
// by the following handshake.
MutexLocker lock(Threads_lock);
// A cancellation at this point means the degenerated cycle must resume from update-refs.
set_gc_state_concurrent(EVACUATION, false);
- set_gc_state_concurrent(WEAK_ROOTS, false);
set_gc_state_concurrent(UPDATE_REFS, true);
+ if (!ShenandoahWeakRootsEarly) {
+ set_gc_state_concurrent(WEAK_ROOTS, false);
+ }
}
// This will propagate the gc state and retire gclabs and plabs for threads that require it.
ShenandoahPrepareForUpdateRefsHandshakeClosure prepare_for_update_refs(_gc_state.raw_value());
< prev index next >