8236981: Remove ShenandoahTraversalUpdateRefsClosure

Reviewed-by: shade, rkennke
This commit is contained in:
Aditya Mandaleeka 2020-03-06 13:41:14 +01:00 committed by Roman Kennke
parent 25d2db06c4
commit 95a497ae9f
4 changed files with 9 additions and 51 deletions

View File

@ -68,20 +68,6 @@ private:
inline void do_oop_work(T* p);
};
class ShenandoahTraversalUpdateRefsClosure: public OopClosure {
private:
ShenandoahHeap* const _heap;
ShenandoahHeapRegionSet* const _traversal_set;
public:
inline ShenandoahTraversalUpdateRefsClosure();
inline void do_oop(oop* p);
inline void do_oop(narrowOop* p);
private:
template <class T>
inline void do_oop_work(T* p);
};
template <DecoratorSet MO = MO_UNORDERED>
class ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure {
private:

View File

@ -83,29 +83,6 @@ void ShenandoahUpdateRefsClosure::do_oop_work(T* p) {
void ShenandoahUpdateRefsClosure::do_oop(oop* p) { do_oop_work(p); }
void ShenandoahUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
ShenandoahTraversalUpdateRefsClosure::ShenandoahTraversalUpdateRefsClosure() :
_heap(ShenandoahHeap::heap()),
_traversal_set(ShenandoahHeap::heap()->traversal_gc()->traversal_set()) {
assert(_heap->is_traversal_mode(), "Why we here?");
}
template <class T>
void ShenandoahTraversalUpdateRefsClosure::do_oop_work(T* p) {
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
if (_heap->in_collection_set(obj) || _traversal_set->is_in(obj)) {
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
RawAccess<IS_NOT_NULL>::oop_store(p, obj);
} else {
shenandoah_assert_not_forwarded(p, obj);
}
}
}
void ShenandoahTraversalUpdateRefsClosure::do_oop(oop* p) { do_oop_work(p); }
void ShenandoahTraversalUpdateRefsClosure::do_oop(narrowOop* p) { do_oop_work(p); }
template <DecoratorSet MO>
ShenandoahEvacuateUpdateRootsClosure<MO>::ShenandoahEvacuateUpdateRootsClosure() :
_heap(ShenandoahHeap::heap()), _thread(Thread::current()) {

View File

@ -2180,19 +2180,11 @@ void ShenandoahHeap::stw_process_weak_roots(bool full_gc) {
ShenandoahGCPhase phase(timing_phase);
phase_timings()->record_workers_start(timing_phase);
if (has_forwarded_objects()) {
if (is_traversal_mode()) {
ShenandoahForwardedIsAliveClosure is_alive;
ShenandoahTraversalUpdateRefsClosure keep_alive;
ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahTraversalUpdateRefsClosure>
cleaning_task(&is_alive, &keep_alive, num_workers, !ShenandoahConcurrentRoots::should_do_concurrent_class_unloading());
_workers->run_task(&cleaning_task);
} else {
ShenandoahForwardedIsAliveClosure is_alive;
ShenandoahUpdateRefsClosure keep_alive;
ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahUpdateRefsClosure>
cleaning_task(&is_alive, &keep_alive, num_workers, !ShenandoahConcurrentRoots::should_do_concurrent_class_unloading());
_workers->run_task(&cleaning_task);
}
ShenandoahForwardedIsAliveClosure is_alive;
ShenandoahUpdateRefsClosure keep_alive;
ShenandoahParallelWeakRootsCleaningTask<ShenandoahForwardedIsAliveClosure, ShenandoahUpdateRefsClosure>
cleaning_task(&is_alive, &keep_alive, num_workers, !ShenandoahConcurrentRoots::should_do_concurrent_class_unloading());
_workers->run_task(&cleaning_task);
} else {
ShenandoahIsAliveClosure is_alive;
#ifdef ASSERT

View File

@ -605,8 +605,11 @@ void ShenandoahTraversalGC::final_traversal_collection() {
// that results the TLAB/GCLAB not usable. Retire them here.
_heap->make_parsable(true);
_heap->parallel_cleaning(false);
// Do this fixup before the call to parallel_cleaning to ensure that all
// forwarded objects (including those that are no longer in the cset) are
// updated by the time we do weak root processing.
fixup_roots();
_heap->parallel_cleaning(false);
_heap->set_has_forwarded_objects(false);