--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp Mon Jun 24 15:19:11 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp Mon Jun 24 11:46:46 2019 -0400
@@ -29,11 +29,7 @@
#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 {
@@ -61,10 +57,102 @@
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 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;
+ OopStorage::ParState<CONCURRENT, false /*is_const*/> _itr;
public:
ShenandoahJNIHandleRoots();
@@ -83,18 +171,6 @@
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();
@@ -183,7 +259,8 @@
ShenandoahJNIHandleRoots<false /*concurrent*/> _jni_roots;
ShenandoahClassLoaderDataRoots<false /*single threaded*/> _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;
@@ -201,7 +278,8 @@
ShenandoahJNIHandleRoots<false /*concurrent*/> _jni_roots;
ShenandoahClassLoaderDataRoots<false /*single threaded*/> _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;
@@ -220,7 +298,8 @@
ShenandoahJNIHandleRoots<false /*concurrent*/> _jni_roots;
ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
ShenandoahThreadRoots _thread_roots;
- ShenandoahWeakRoots _weak_roots;
+ ShenandoahSerialWeakRoots _serial_weak_roots;
+ ShenandoahWeakRoots<false /*concurrent*/> _weak_roots;
ShenandoahStringDedupRoots _dedup_roots;
ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;