8342588: Shenandoah: Pull shared closures together in one header
Reviewed-by: wkemper, kdnilsen, simonis
This commit is contained in:
parent
f7f5198367
commit
9003524c8b
@ -25,18 +25,78 @@
|
||||
#define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP
|
||||
|
||||
#include "code/nmethod.hpp"
|
||||
#include "gc/shared/stringdedup/stringDedup.hpp"
|
||||
#include "gc/shenandoah/shenandoahGenerationType.hpp"
|
||||
#include "gc/shenandoah/shenandoahTaskqueue.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
#include "oops/accessDecorators.hpp"
|
||||
#include "runtime/handshake.hpp"
|
||||
#include "runtime/javaThread.hpp"
|
||||
|
||||
class BarrierSetNMethod;
|
||||
class ShenandoahBarrierSet;
|
||||
class ShenandoahHeap;
|
||||
class ShenandoahMarkingContext;
|
||||
class ShenandoahHeapRegionSet;
|
||||
class Thread;
|
||||
class ShenandoahReferenceProcessor;
|
||||
|
||||
class ShenandoahForwardedIsAliveClosure: public BoolObjectClosure {
|
||||
//
|
||||
// ========= Super
|
||||
//
|
||||
|
||||
class ShenandoahSuperClosure : public MetadataVisitingOopIterateClosure {
|
||||
protected:
|
||||
ShenandoahHeap* const _heap;
|
||||
|
||||
public:
|
||||
inline ShenandoahSuperClosure();
|
||||
inline ShenandoahSuperClosure(ShenandoahReferenceProcessor* rp);
|
||||
inline void do_nmethod(nmethod* nm);
|
||||
};
|
||||
|
||||
//
|
||||
// ========= Marking
|
||||
//
|
||||
|
||||
class ShenandoahMarkRefsSuperClosure : public ShenandoahSuperClosure {
|
||||
private:
|
||||
ShenandoahObjToScanQueue* _queue;
|
||||
ShenandoahMarkingContext* const _mark_context;
|
||||
bool _weak;
|
||||
|
||||
protected:
|
||||
template <class T, ShenandoahGenerationType GENERATION>
|
||||
void work(T *p);
|
||||
|
||||
public:
|
||||
inline ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp);
|
||||
|
||||
bool is_weak() const {
|
||||
return _weak;
|
||||
}
|
||||
|
||||
void set_weak(bool weak) {
|
||||
_weak = weak;
|
||||
}
|
||||
|
||||
virtual void do_nmethod(nmethod* nm) {
|
||||
assert(!is_weak(), "Can't handle weak marking of nmethods");
|
||||
ShenandoahSuperClosure::do_nmethod(nm);
|
||||
}
|
||||
};
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
class ShenandoahMarkRefsClosure : public ShenandoahMarkRefsSuperClosure {
|
||||
private:
|
||||
template <class T>
|
||||
inline void do_oop_work(T* p) { work<T, GENERATION>(p); }
|
||||
|
||||
public:
|
||||
ShenandoahMarkRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
|
||||
ShenandoahMarkRefsSuperClosure(q, rp) {};
|
||||
|
||||
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
virtual void do_oop(oop* p) { do_oop_work(p); }
|
||||
};
|
||||
|
||||
class ShenandoahForwardedIsAliveClosure : public BoolObjectClosure {
|
||||
private:
|
||||
ShenandoahMarkingContext* const _mark_context;
|
||||
public:
|
||||
@ -44,7 +104,7 @@ public:
|
||||
inline bool do_object_b(oop obj);
|
||||
};
|
||||
|
||||
class ShenandoahIsAliveClosure: public BoolObjectClosure {
|
||||
class ShenandoahIsAliveClosure : public BoolObjectClosure {
|
||||
private:
|
||||
ShenandoahMarkingContext* const _mark_context;
|
||||
public:
|
||||
@ -63,27 +123,29 @@ public:
|
||||
class ShenandoahKeepAliveClosure : public OopClosure {
|
||||
private:
|
||||
ShenandoahBarrierSet* const _bs;
|
||||
public:
|
||||
inline ShenandoahKeepAliveClosure();
|
||||
inline void do_oop(oop* p);
|
||||
inline void do_oop(narrowOop* p);
|
||||
private:
|
||||
template <typename T>
|
||||
void do_oop_work(T* p);
|
||||
};
|
||||
|
||||
class ShenandoahOopClosureBase : public MetadataVisitingOopIterateClosure {
|
||||
public:
|
||||
inline void do_nmethod(nmethod* nm);
|
||||
inline ShenandoahKeepAliveClosure();
|
||||
inline void do_oop(oop* p) { do_oop_work(p); }
|
||||
inline void do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
};
|
||||
|
||||
template <bool concurrent, bool stable_thread>
|
||||
class ShenandoahEvacuateUpdateRootClosureBase : public ShenandoahOopClosureBase {
|
||||
|
||||
//
|
||||
// ========= Evacuating + Roots
|
||||
//
|
||||
|
||||
template <bool CONCURRENT, bool STABLE_THREAD>
|
||||
class ShenandoahEvacuateUpdateRootClosureBase : public ShenandoahSuperClosure {
|
||||
protected:
|
||||
ShenandoahHeap* const _heap;
|
||||
Thread* const _thread;
|
||||
public:
|
||||
inline ShenandoahEvacuateUpdateRootClosureBase();
|
||||
inline ShenandoahEvacuateUpdateRootClosureBase() :
|
||||
ShenandoahSuperClosure(),
|
||||
_thread(STABLE_THREAD ? Thread::current() : nullptr) {}
|
||||
|
||||
inline void do_oop(oop* p);
|
||||
inline void do_oop(narrowOop* p);
|
||||
protected:
|
||||
@ -91,10 +153,11 @@ protected:
|
||||
inline void do_oop_work(T* p);
|
||||
};
|
||||
|
||||
using ShenandoahEvacuateUpdateMetadataClosure = ShenandoahEvacuateUpdateRootClosureBase<false, true>;
|
||||
using ShenandoahEvacuateUpdateRootsClosure = ShenandoahEvacuateUpdateRootClosureBase<true, false>;
|
||||
using ShenandoahEvacuateUpdateMetadataClosure = ShenandoahEvacuateUpdateRootClosureBase<false, true>;
|
||||
using ShenandoahEvacuateUpdateRootsClosure = ShenandoahEvacuateUpdateRootClosureBase<true, false>;
|
||||
using ShenandoahContextEvacuateUpdateRootsClosure = ShenandoahEvacuateUpdateRootClosureBase<true, true>;
|
||||
|
||||
|
||||
template <bool CONCURRENT, typename IsAlive, typename KeepAlive>
|
||||
class ShenandoahCleanUpdateWeakOopsClosure : public OopClosure {
|
||||
private:
|
||||
@ -107,7 +170,7 @@ public:
|
||||
inline void do_oop(narrowOop* p);
|
||||
};
|
||||
|
||||
class ShenandoahNMethodAndDisarmClosure: public NMethodToOopClosure {
|
||||
class ShenandoahNMethodAndDisarmClosure : public NMethodToOopClosure {
|
||||
private:
|
||||
BarrierSetNMethod* const _bs;
|
||||
|
||||
@ -116,6 +179,51 @@ public:
|
||||
inline void do_nmethod(nmethod* nm);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ========= Update References
|
||||
//
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
class ShenandoahMarkUpdateRefsClosure : public ShenandoahMarkRefsSuperClosure {
|
||||
private:
|
||||
template <class T>
|
||||
inline void work(T* p);
|
||||
|
||||
public:
|
||||
ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp);
|
||||
|
||||
virtual void do_oop(narrowOop* p) { work(p); }
|
||||
virtual void do_oop(oop* p) { work(p); }
|
||||
};
|
||||
|
||||
class ShenandoahUpdateRefsSuperClosure : public ShenandoahSuperClosure {};
|
||||
|
||||
class ShenandoahNonConcUpdateRefsClosure : public ShenandoahUpdateRefsSuperClosure {
|
||||
private:
|
||||
template<class T>
|
||||
inline void work(T* p);
|
||||
|
||||
public:
|
||||
virtual void do_oop(narrowOop* p) { work(p); }
|
||||
virtual void do_oop(oop* p) { work(p); }
|
||||
};
|
||||
|
||||
class ShenandoahConcUpdateRefsClosure : public ShenandoahUpdateRefsSuperClosure {
|
||||
private:
|
||||
template<class T>
|
||||
inline void work(T* p);
|
||||
|
||||
public:
|
||||
virtual void do_oop(narrowOop* p) { work(p); }
|
||||
virtual void do_oop(oop* p) { work(p); }
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ========= Utilities
|
||||
//
|
||||
|
||||
#ifdef ASSERT
|
||||
class ShenandoahAssertNotForwardedClosure : public OopClosure {
|
||||
private:
|
||||
|
@ -33,15 +33,46 @@
|
||||
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
#include "oops/compressedOops.inline.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/javaThread.hpp"
|
||||
|
||||
ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
|
||||
_mark_context(ShenandoahHeap::heap()->marking_context()) {
|
||||
//
|
||||
// ========= Super
|
||||
//
|
||||
|
||||
ShenandoahSuperClosure::ShenandoahSuperClosure() :
|
||||
MetadataVisitingOopIterateClosure(), _heap(ShenandoahHeap::heap()) {}
|
||||
|
||||
ShenandoahSuperClosure::ShenandoahSuperClosure(ShenandoahReferenceProcessor* rp) :
|
||||
MetadataVisitingOopIterateClosure(rp), _heap(ShenandoahHeap::heap()) {}
|
||||
|
||||
void ShenandoahSuperClosure::do_nmethod(nmethod* nm) {
|
||||
nm->run_nmethod_entry_barrier();
|
||||
}
|
||||
|
||||
//
|
||||
// ========= Marking
|
||||
//
|
||||
|
||||
ShenandoahMarkRefsSuperClosure::ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
|
||||
ShenandoahSuperClosure(rp),
|
||||
_queue(q),
|
||||
_mark_context(ShenandoahHeap::heap()->marking_context()),
|
||||
_weak(false) {}
|
||||
|
||||
template<class T, ShenandoahGenerationType GENERATION>
|
||||
inline void ShenandoahMarkRefsSuperClosure::work(T* p) {
|
||||
ShenandoahMark::mark_through_ref<T, GENERATION>(p, _queue, _mark_context, _weak);
|
||||
}
|
||||
|
||||
ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
|
||||
_mark_context(ShenandoahHeap::heap()->marking_context()) {}
|
||||
|
||||
bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
|
||||
if (CompressedOops::is_null(obj)) {
|
||||
return false;
|
||||
@ -52,8 +83,7 @@ bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
|
||||
}
|
||||
|
||||
ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
|
||||
_mark_context(ShenandoahHeap::heap()->marking_context()) {
|
||||
}
|
||||
_mark_context(ShenandoahHeap::heap()->marking_context()) {}
|
||||
|
||||
bool ShenandoahIsAliveClosure::do_object_b(oop obj) {
|
||||
if (CompressedOops::is_null(obj)) {
|
||||
@ -69,21 +99,8 @@ BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() {
|
||||
reinterpret_cast<BoolObjectClosure*>(&_alive_cl);
|
||||
}
|
||||
|
||||
void ShenandoahOopClosureBase::do_nmethod(nmethod* nm) {
|
||||
nm->run_nmethod_entry_barrier();
|
||||
}
|
||||
|
||||
ShenandoahKeepAliveClosure::ShenandoahKeepAliveClosure() :
|
||||
_bs(ShenandoahBarrierSet::barrier_set()) {
|
||||
}
|
||||
|
||||
void ShenandoahKeepAliveClosure::do_oop(oop* p) {
|
||||
do_oop_work(p);
|
||||
}
|
||||
|
||||
void ShenandoahKeepAliveClosure::do_oop(narrowOop* p) {
|
||||
do_oop_work(p);
|
||||
}
|
||||
_bs(ShenandoahBarrierSet::barrier_set()) {}
|
||||
|
||||
template <typename T>
|
||||
void ShenandoahKeepAliveClosure::do_oop_work(T* p) {
|
||||
@ -97,14 +114,14 @@ void ShenandoahKeepAliveClosure::do_oop_work(T* p) {
|
||||
}
|
||||
}
|
||||
|
||||
template <bool concurrent, bool stable_thread>
|
||||
ShenandoahEvacuateUpdateRootClosureBase<concurrent, stable_thread>::ShenandoahEvacuateUpdateRootClosureBase() :
|
||||
_heap(ShenandoahHeap::heap()), _thread(stable_thread ? Thread::current() : nullptr) {
|
||||
}
|
||||
|
||||
template <bool concurrent, bool stable_thread>
|
||||
void ShenandoahEvacuateUpdateRootClosureBase<concurrent, stable_thread>::do_oop(oop* p) {
|
||||
if (concurrent) {
|
||||
//
|
||||
// ========= Evacuating + Roots
|
||||
//
|
||||
|
||||
template <bool CONCURRENT, bool STABLE_THREAD>
|
||||
void ShenandoahEvacuateUpdateRootClosureBase<CONCURRENT, STABLE_THREAD>::do_oop(oop* p) {
|
||||
if (CONCURRENT) {
|
||||
ShenandoahEvacOOMScope scope;
|
||||
do_oop_work(p);
|
||||
} else {
|
||||
@ -112,9 +129,9 @@ void ShenandoahEvacuateUpdateRootClosureBase<concurrent, stable_thread>::do_oop(
|
||||
}
|
||||
}
|
||||
|
||||
template <bool concurrent, bool stable_thread>
|
||||
void ShenandoahEvacuateUpdateRootClosureBase<concurrent, stable_thread>::do_oop(narrowOop* p) {
|
||||
if (concurrent) {
|
||||
template <bool CONCURRENT, bool STABLE_THREAD>
|
||||
void ShenandoahEvacuateUpdateRootClosureBase<CONCURRENT, STABLE_THREAD>::do_oop(narrowOop* p) {
|
||||
if (CONCURRENT) {
|
||||
ShenandoahEvacOOMScope scope;
|
||||
do_oop_work(p);
|
||||
} else {
|
||||
@ -122,9 +139,9 @@ void ShenandoahEvacuateUpdateRootClosureBase<concurrent, stable_thread>::do_oop(
|
||||
}
|
||||
}
|
||||
|
||||
template <bool atomic, bool stable_thread>
|
||||
template <bool CONCURRENT, bool STABLE_THREAD>
|
||||
template <class T>
|
||||
void ShenandoahEvacuateUpdateRootClosureBase<atomic, stable_thread>::do_oop_work(T* p) {
|
||||
void ShenandoahEvacuateUpdateRootClosureBase<CONCURRENT, STABLE_THREAD>::do_oop_work(T* p) {
|
||||
assert(_heap->is_concurrent_weak_root_in_progress() ||
|
||||
_heap->is_concurrent_strong_root_in_progress(),
|
||||
"Only do this in root processing phase");
|
||||
@ -137,12 +154,12 @@ void ShenandoahEvacuateUpdateRootClosureBase<atomic, stable_thread>::do_oop_work
|
||||
shenandoah_assert_marked(p, obj);
|
||||
oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
|
||||
if (resolved == obj) {
|
||||
Thread* thr = stable_thread ? _thread : Thread::current();
|
||||
Thread* thr = STABLE_THREAD ? _thread : Thread::current();
|
||||
assert(thr == Thread::current(), "Wrong thread");
|
||||
|
||||
resolved = _heap->evacuate_object(obj, thr);
|
||||
}
|
||||
if (atomic) {
|
||||
if (CONCURRENT) {
|
||||
ShenandoahHeap::atomic_update_oop(resolved, p, o);
|
||||
} else {
|
||||
RawAccess<IS_NOT_NULL | MO_UNORDERED>::oop_store(p, resolved);
|
||||
@ -192,6 +209,42 @@ void ShenandoahNMethodAndDisarmClosure::do_nmethod(nmethod* nm) {
|
||||
_bs->disarm(nm);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ========= Update References
|
||||
//
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
ShenandoahMarkUpdateRefsClosure<GENERATION>::ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
|
||||
ShenandoahMarkRefsSuperClosure(q, rp) {
|
||||
assert(_heap->is_stw_gc_in_progress(), "Can only be used for STW GC");
|
||||
}
|
||||
|
||||
template<ShenandoahGenerationType GENERATION>
|
||||
template<class T>
|
||||
inline void ShenandoahMarkUpdateRefsClosure<GENERATION>::work(T* p) {
|
||||
// Update the location
|
||||
_heap->non_conc_update_with_forwarded(p);
|
||||
|
||||
// ...then do the usual thing
|
||||
ShenandoahMarkRefsSuperClosure::work<T, GENERATION>(p);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void ShenandoahNonConcUpdateRefsClosure::work(T* p) {
|
||||
_heap->non_conc_update_with_forwarded(p);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void ShenandoahConcUpdateRefsClosure::work(T* p) {
|
||||
_heap->conc_update_with_forwarded(p);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ========= Utilities
|
||||
//
|
||||
|
||||
#ifdef ASSERT
|
||||
template <class T>
|
||||
void ShenandoahAssertNotForwardedClosure::do_oop_work(T* p) {
|
||||
|
@ -29,13 +29,13 @@
|
||||
#include "gc/shared/collectorCounters.hpp"
|
||||
#include "gc/shared/continuationGCSupport.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahBreakpoint.hpp"
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
|
||||
#include "gc/shenandoah/shenandoahConcurrentGC.hpp"
|
||||
#include "gc/shenandoah/shenandoahFreeSet.hpp"
|
||||
#include "gc/shenandoah/shenandoahLock.hpp"
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||
#include "gc/shenandoah/shenandoahStringDedup.hpp"
|
||||
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMetrics.hpp"
|
||||
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahSTWMark.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "gc/shared/tlab_globals.hpp"
|
||||
#include "gc/shared/workerThread.hpp"
|
||||
#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
|
||||
#include "gc/shenandoah/shenandoahConcurrentGC.hpp"
|
||||
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
|
||||
@ -44,7 +45,6 @@
|
||||
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMetrics.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahSTWMark.hpp"
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahGC.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeap.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include "gc/shenandoah/shenandoahMemoryPool.hpp"
|
||||
#include "gc/shenandoah/shenandoahMetrics.hpp"
|
||||
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahPacer.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahPadding.hpp"
|
||||
#include "gc/shenandoah/shenandoahParallelCleaning.inline.hpp"
|
||||
|
@ -28,19 +28,11 @@
|
||||
#include "gc/shenandoah/shenandoahBarrierSet.hpp"
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
#include "gc/shenandoah/shenandoahVerifier.hpp"
|
||||
|
||||
ShenandoahMarkRefsSuperClosure::ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
|
||||
MetadataVisitingOopIterateClosure(rp),
|
||||
_queue(q),
|
||||
_mark_context(ShenandoahHeap::heap()->marking_context()),
|
||||
_weak(false)
|
||||
{ }
|
||||
|
||||
ShenandoahMark::ShenandoahMark() :
|
||||
_task_queues(ShenandoahHeap::heap()->marking_context()->task_queues()) {
|
||||
}
|
||||
|
@ -30,9 +30,9 @@
|
||||
#include "gc/shared/continuationGCSupport.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahAsserts.hpp"
|
||||
#include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahStringDedup.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/continuation.hpp"
|
||||
#include "runtime/safepointVerifiers.hpp"
|
||||
|
@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Red Hat, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
|
||||
#define SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
|
||||
|
||||
#include "gc/shared/stringdedup/stringDedup.hpp"
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahGenerationType.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahTaskqueue.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
#include "runtime/javaThread.hpp"
|
||||
|
||||
class ShenandoahMarkRefsSuperClosure : public MetadataVisitingOopIterateClosure {
|
||||
private:
|
||||
ShenandoahObjToScanQueue* _queue;
|
||||
ShenandoahMarkingContext* const _mark_context;
|
||||
bool _weak;
|
||||
|
||||
protected:
|
||||
template <class T, ShenandoahGenerationType GENERATION>
|
||||
void work(T *p);
|
||||
|
||||
public:
|
||||
ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp);
|
||||
|
||||
bool is_weak() const {
|
||||
return _weak;
|
||||
}
|
||||
|
||||
void set_weak(bool weak) {
|
||||
_weak = weak;
|
||||
}
|
||||
|
||||
virtual void do_nmethod(nmethod* nm) {
|
||||
assert(!is_weak(), "Can't handle weak marking of nmethods");
|
||||
nm->run_nmethod_entry_barrier();
|
||||
}
|
||||
};
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
class ShenandoahMarkUpdateRefsClosure : public ShenandoahMarkRefsSuperClosure {
|
||||
private:
|
||||
ShenandoahHeap* const _heap;
|
||||
|
||||
template <class T>
|
||||
inline void work(T* p);
|
||||
|
||||
public:
|
||||
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");
|
||||
}
|
||||
|
||||
virtual void do_oop(narrowOop* p) { work(p); }
|
||||
virtual void do_oop(oop* p) { work(p); }
|
||||
};
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
class ShenandoahMarkRefsClosure : public ShenandoahMarkRefsSuperClosure {
|
||||
private:
|
||||
template <class T>
|
||||
inline void do_oop_work(T* p) { work<T, GENERATION>(p); }
|
||||
|
||||
public:
|
||||
ShenandoahMarkRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
|
||||
ShenandoahMarkRefsSuperClosure(q, rp) {};
|
||||
|
||||
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
virtual void do_oop(oop* p) { do_oop_work(p); }
|
||||
};
|
||||
|
||||
class ShenandoahUpdateRefsSuperClosure : public ShenandoahOopClosureBase {
|
||||
protected:
|
||||
ShenandoahHeap* _heap;
|
||||
|
||||
public:
|
||||
ShenandoahUpdateRefsSuperClosure() : _heap(ShenandoahHeap::heap()) {}
|
||||
};
|
||||
|
||||
class ShenandoahNonConcUpdateRefsClosure : public ShenandoahUpdateRefsSuperClosure {
|
||||
private:
|
||||
template<class T>
|
||||
inline void work(T* p);
|
||||
|
||||
public:
|
||||
ShenandoahNonConcUpdateRefsClosure() : ShenandoahUpdateRefsSuperClosure() {}
|
||||
|
||||
virtual void do_oop(narrowOop* p) { work(p); }
|
||||
virtual void do_oop(oop* p) { work(p); }
|
||||
};
|
||||
|
||||
class ShenandoahConcUpdateRefsClosure : public ShenandoahUpdateRefsSuperClosure {
|
||||
private:
|
||||
template<class T>
|
||||
inline void work(T* p);
|
||||
|
||||
public:
|
||||
ShenandoahConcUpdateRefsClosure() : ShenandoahUpdateRefsSuperClosure() {}
|
||||
|
||||
virtual void do_oop(narrowOop* p) { work(p); }
|
||||
virtual void do_oop(oop* p) { work(p); }
|
||||
};
|
||||
|
||||
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_HPP
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2021, Red Hat, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_INLINE_HPP
|
||||
#define SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_INLINE_HPP
|
||||
|
||||
#include "gc/shenandoah/shenandoahOopClosures.hpp"
|
||||
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
|
||||
template<class T, ShenandoahGenerationType GENERATION>
|
||||
inline void ShenandoahMarkRefsSuperClosure::work(T* p) {
|
||||
ShenandoahMark::mark_through_ref<T, GENERATION>(p, _queue, _mark_context, _weak);
|
||||
}
|
||||
|
||||
template<ShenandoahGenerationType GENERATION>
|
||||
template<class T>
|
||||
inline void ShenandoahMarkUpdateRefsClosure<GENERATION>::work(T* p) {
|
||||
// Update the location
|
||||
_heap->non_conc_update_with_forwarded(p);
|
||||
|
||||
// ...then do the usual thing
|
||||
ShenandoahMarkRefsSuperClosure::work<T, GENERATION>(p);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void ShenandoahNonConcUpdateRefsClosure::work(T* p) {
|
||||
_heap->non_conc_update_with_forwarded(p);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void ShenandoahConcUpdateRefsClosure::work(T* p) {
|
||||
_heap->conc_update_with_forwarded(p);
|
||||
}
|
||||
|
||||
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHOOPCLOSURES_INLINE_HPP
|
@ -26,7 +26,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/javaClasses.hpp"
|
||||
#include "gc/shared/workerThread.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahThreadLocalData.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahGenerationType.hpp"
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahReferenceProcessor.hpp"
|
||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahSTWMark.hpp"
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include "gc/shenandoah/shenandoahDegeneratedGC.hpp"
|
||||
#include "gc/shenandoah/shenandoahFullGC.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahMark.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
|
||||
#include "gc/shenandoah/shenandoahUtils.hpp"
|
||||
#include "gc/shenandoah/shenandoahVMOperations.hpp"
|
||||
#include "interpreter/oopMapCache.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user