< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp
Print this page
rev 55429 : 8226311: Shenandoah: Concurrent evacuation of OopStorage backed weak roots
@@ -27,15 +27,11 @@
#include "code/codeCache.hpp"
#include "gc/shared/oopStorageParState.hpp"
#include "gc/shenandoah/shenandoahCodeRoots.hpp"
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
-#include "gc/shared/strongRootsScope.hpp"
-#include "gc/shared/weakProcessor.hpp"
-#include "gc/shared/weakProcessorPhaseTimes.hpp"
-#include "gc/shared/workgroup.hpp"
-#include "memory/allocation.hpp"
+#include "gc/shenandoah/shenandoahSharedVariables.hpp"
#include "memory/iterator.hpp"
class ShenandoahSerialRoot {
public:
typedef void (*OopsDo)(OopClosure*);
@@ -59,14 +55,106 @@
public:
ShenandoahSerialRoots();
void oops_do(OopClosure* cl, uint worker_id);
};
+class ShenandoahWeakSerialRoot {
+ typedef void (*WeakOopsDo)(BoolObjectClosure*, OopClosure*);
+private:
+ ShenandoahSharedFlag _claimed;
+ const WeakOopsDo _weak_oops_do;
+ const ShenandoahPhaseTimings::GCParPhases _phase;
+
+public:
+ ShenandoahWeakSerialRoot(WeakOopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
+ void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
+};
+
+#if INCLUDE_JVMTI
+class ShenandoahJVMTIWeakRoot : public ShenandoahWeakSerialRoot {
+public:
+ ShenandoahJVMTIWeakRoot();
+};
+#endif // INCLUDE_JVMTI
+
+#if INCLUDE_JFR
+class ShenandoahJFRWeakRoot : public ShenandoahWeakSerialRoot {
+public:
+ ShenandoahJFRWeakRoot();
+};
+#endif // INCLUDE_JFR
+
+class ShenandoahSerialWeakRoots {
+private:
+ JVMTI_ONLY(ShenandoahJVMTIWeakRoot _jvmti_weak_roots;)
+ JFR_ONLY(ShenandoahJFRWeakRoot _jfr_weak_roots;)
+public:
+ void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
+ void weak_oops_do(OopClosure* cl, uint worker_id);
+};
+
template <bool CONCURRENT>
-class ShenandoahJNIHandleRoots {
+class ShenandoahWeakRoot {
private:
OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
+ const ShenandoahPhaseTimings::GCParPhases _phase;
+public:
+ ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
+
+ template <typename Closure>
+ void oops_do(Closure* cl, uint worker_id);
+};
+
+template <>
+class ShenandoahWeakRoot<false /*concurrent*/> {
+private:
+ OopStorage::ParState<false /*concurrent*/, false /*is_const*/> _itr;
+ const ShenandoahPhaseTimings::GCParPhases _phase;
+
+public:
+ ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
+
+ template <typename IsAliveClosure, typename KeepAliveClosure>
+ void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
+};
+
+template <bool CONCURRENT>
+class ShenandoahWeakRoots {
+private:
+ ShenandoahWeakRoot<CONCURRENT> _jni_roots;
+ ShenandoahWeakRoot<CONCURRENT> _string_table_roots;
+ ShenandoahWeakRoot<CONCURRENT> _resolved_method_table_roots;
+ ShenandoahWeakRoot<CONCURRENT> _vm_roots;
+
+public:
+ ShenandoahWeakRoots();
+
+ template <typename Closure>
+ void oops_do(Closure* cl, uint worker_id = 0);
+};
+
+template <>
+class ShenandoahWeakRoots<false /*concurrent */> {
+private:
+ ShenandoahWeakRoot<false /*concurrent*/> _jni_roots;
+ ShenandoahWeakRoot<false /*concurrent*/> _string_table_roots;
+ ShenandoahWeakRoot<false /*concurrent*/> _resolved_method_table_roots;
+ ShenandoahWeakRoot<false /*concurrent*/> _vm_roots;
+public:
+ ShenandoahWeakRoots();
+
+ template <typename Closure>
+ void oops_do(Closure* cl, uint worker_id = 0);
+
+ template <typename IsAliveClosure, typename KeepAliveClosure>
+ void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
+};
+
+template <bool CONCURRENT>
+class ShenandoahJNIHandleRoots {
+private:
+ OopStorage::ParState<CONCURRENT, false /*is_const*/> _itr;
public:
ShenandoahJNIHandleRoots();
template <typename T>
void oops_do(T* cl, uint worker_id = 0);
@@ -81,22 +169,10 @@
void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
void threads_do(ThreadClosure* tc, uint worker_id);
};
-class ShenandoahWeakRoots {
-private:
- WeakProcessorPhaseTimes _process_timings;
- WeakProcessor::Task _task;
-public:
- ShenandoahWeakRoots(uint n_workers);
- ~ShenandoahWeakRoots();
-
- template <typename IsAlive, typename KeepAlive>
- void oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id);
-};
-
class ShenandoahStringDedupRoots {
public:
ShenandoahStringDedupRoots();
~ShenandoahStringDedupRoots();
@@ -165,11 +241,12 @@
private:
ShenandoahSerialRoots _serial_roots;
ShenandoahJNIHandleRoots<false /*concurrent*/> _jni_roots;
ShenandoahClassLoaderDataRoots _cld_roots;
ShenandoahThreadRoots _thread_roots;
- ShenandoahWeakRoots _weak_roots;
+ ShenandoahSerialWeakRoots _serial_weak_roots;
+ ShenandoahWeakRoots<false /*concurrent*/> _weak_roots;
ShenandoahStringDedupRoots _dedup_roots;
ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
bool _include_concurrent_roots;
public:
@@ -183,11 +260,12 @@
private:
ShenandoahSerialRoots _serial_roots;
ShenandoahJNIHandleRoots<false /*concurrent*/> _jni_roots;
ShenandoahClassLoaderDataRoots _cld_roots;
ShenandoahThreadRoots _thread_roots;
- ShenandoahWeakRoots _weak_roots;
+ ShenandoahSerialWeakRoots _serial_weak_roots;
+ ShenandoahWeakRoots<false /*concurrent*/> _weak_roots;
ShenandoahStringDedupRoots _dedup_roots;
ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
const bool _update_code_cache;
public:
@@ -202,11 +280,12 @@
private:
ShenandoahSerialRoots _serial_roots;
ShenandoahJNIHandleRoots<false /*concurrent*/> _jni_roots;
ShenandoahClassLoaderDataRoots _cld_roots;
ShenandoahThreadRoots _thread_roots;
- ShenandoahWeakRoots _weak_roots;
+ ShenandoahSerialWeakRoots _serial_weak_roots;
+ ShenandoahWeakRoots<false /*concurrent*/> _weak_roots;
ShenandoahStringDedupRoots _dedup_roots;
ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
public:
ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
< prev index next >