Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions src/hotspot/share/gc/shenandoah/shenandoahOopClosures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,23 @@ class ShenandoahMarkRefsSuperClosure : public MetadataVisitingOopIterateClosure
}
};

class ShenandoahMarkUpdateRefsSuperClosure : public ShenandoahMarkRefsSuperClosure {
protected:
template <ShenandoahGenerationType GENERATION>
class ShenandoahMarkUpdateRefsClosure : public ShenandoahMarkRefsSuperClosure {
private:
ShenandoahHeap* const _heap;

template <class T, ShenandoahGenerationType GENERATION>
template <class T>
inline void work(T* p);

public:
ShenandoahMarkUpdateRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
ShenandoahMarkRefsSuperClosure(q, rp),
_heap(ShenandoahHeap::heap()) {
assert(_heap->is_stw_gc_in_progress(), "Can only be used for STW GC");
};
};

template <ShenandoahGenerationType GENERATION>
class ShenandoahMarkUpdateRefsClosure : public ShenandoahMarkUpdateRefsSuperClosure {
private:
template <class T>
inline void do_oop_work(T* p) { work<T, GENERATION>(p); }

public:
ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
ShenandoahMarkUpdateRefsSuperClosure(q, rp) {}
}

virtual void do_oop(narrowOop* p) { do_oop_work(p); }
virtual void do_oop(oop* p) { do_oop_work(p); }
virtual void do_oop(narrowOop* p) { work(p); }
virtual void do_oop(oop* p) { work(p); }
};

template <ShenandoahGenerationType GENERATION>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ inline void ShenandoahMarkRefsSuperClosure::work(T* p) {
ShenandoahMark::mark_through_ref<T, GENERATION>(p, _queue, _mark_context, _weak);
}

template<class T, ShenandoahGenerationType GENERATION>
inline void ShenandoahMarkUpdateRefsSuperClosure::work(T* p) {
template<ShenandoahGenerationType GENERATION>
template<class T>
inline void ShenandoahMarkUpdateRefsClosure<GENERATION>::work(T* p) {
// Update the location
_heap->update_with_forwarded(p);

Expand Down