44 const OopsDo _oops_do;
45 const ShenandoahPhaseTimings::GCParPhases _phase;
46
47 public:
48 ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
49 void oops_do(OopClosure* cl, uint worker_id);
50 };
51
52 class ShenandoahSerialRoots {
53 private:
54 ShenandoahSerialRoot _universe_root;
55 ShenandoahSerialRoot _object_synchronizer_root;
56 ShenandoahSerialRoot _management_root;
57 ShenandoahSerialRoot _system_dictionary_root;
58 ShenandoahSerialRoot _jvmti_root;
59 public:
60 ShenandoahSerialRoots();
61 void oops_do(OopClosure* cl, uint worker_id);
62 };
63
64 class ShenandoahJNIHandleRoots : public ShenandoahSerialRoot {
65 public:
66 ShenandoahJNIHandleRoots();
67 };
68
69 class ShenandoahThreadRoots {
70 private:
71 const bool _is_par;
72 public:
73 ShenandoahThreadRoots(bool is_par);
74 ~ShenandoahThreadRoots();
75
76 void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
77 void threads_do(ThreadClosure* tc, uint worker_id);
78 };
79
80 class ShenandoahWeakRoots {
81 private:
82 WeakProcessorPhaseTimes _process_timings;
83 WeakProcessor::Task _task;
84 public:
85 ShenandoahWeakRoots(uint n_workers);
86 ~ShenandoahWeakRoots();
91
92 class ShenandoahStringDedupRoots {
93 public:
94 ShenandoahStringDedupRoots();
95 ~ShenandoahStringDedupRoots();
96
97 void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
98 };
99
100 template <typename ITR>
101 class ShenandoahCodeCacheRoots {
102 private:
103 ITR _coderoots_iterator;
104 public:
105 ShenandoahCodeCacheRoots();
106 ~ShenandoahCodeCacheRoots();
107
108 void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
109 };
110
111 class ShenandoahClassLoaderDataRoots {
112 public:
113 ShenandoahClassLoaderDataRoots();
114
115 void always_strong_cld_do(CLDClosure* clds, uint worker_id);
116 void cld_do(CLDClosure* clds, uint worker_id);
117 };
118
119 class ShenandoahRootProcessor : public StackObj {
120 private:
121 ShenandoahHeap* const _heap;
122 const ShenandoahPhaseTimings::Phase _phase;
123 public:
124 ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
125 ~ShenandoahRootProcessor();
126
127 ShenandoahHeap* heap() const { return _heap; }
128 };
129
130 template <typename ITR>
131 class ShenandoahRootScanner : public ShenandoahRootProcessor {
132 private:
133 ShenandoahSerialRoots _serial_roots;
134 ShenandoahJNIHandleRoots _jni_roots;
135 ShenandoahClassLoaderDataRoots _cld_roots;
136 ShenandoahThreadRoots _thread_roots;
137 ShenandoahCodeCacheRoots<ITR> _code_roots;
138 public:
139 ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
140
141 // Apply oops, clds and blobs to all strongly reachable roots in the system,
142 // during class unloading cycle
143 void strong_roots_do(uint worker_id, OopClosure* cl);
144 void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
145
146 // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
147 // roots when class unloading is disabled during this cycle
148 void roots_do(uint worker_id, OopClosure* cl);
149 void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
150 // For heap object iteration
151 void roots_do_unchecked(OopClosure* cl);
152 void strong_roots_do_unchecked(OopClosure* cl);
153 };
154
155 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
156 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
157
158 // Evacuate all roots at a safepoint
159 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
160 private:
161 ShenandoahSerialRoots _serial_roots;
162 ShenandoahJNIHandleRoots _jni_roots;
163 ShenandoahClassLoaderDataRoots _cld_roots;
164 ShenandoahThreadRoots _thread_roots;
165 ShenandoahWeakRoots _weak_roots;
166 ShenandoahStringDedupRoots _dedup_roots;
167 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
168
169 public:
170 ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase);
171
172 void roots_do(uint worker_id, OopClosure* oops);
173 };
174
175 // Update all roots at a safepoint
176 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
177 private:
178 ShenandoahSerialRoots _serial_roots;
179 ShenandoahJNIHandleRoots _jni_roots;
180 ShenandoahClassLoaderDataRoots _cld_roots;
181 ShenandoahThreadRoots _thread_roots;
182 ShenandoahWeakRoots _weak_roots;
183 ShenandoahStringDedupRoots _dedup_roots;
184 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
185 const bool _update_code_cache;
186
187 public:
188 ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
189
190 template<typename IsAlive, typename KeepAlive>
191 void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
192 };
193
194 // Adjuster all roots at a safepoint during full gc
195 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
196 private:
197 ShenandoahSerialRoots _serial_roots;
198 ShenandoahJNIHandleRoots _jni_roots;
199 ShenandoahClassLoaderDataRoots _cld_roots;
200 ShenandoahThreadRoots _thread_roots;
201 ShenandoahWeakRoots _weak_roots;
202 ShenandoahStringDedupRoots _dedup_roots;
203 ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
204
205 public:
206 ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
207
208 void roots_do(uint worker_id, OopClosure* oops);
209 };
210
211 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
|
44 const OopsDo _oops_do;
45 const ShenandoahPhaseTimings::GCParPhases _phase;
46
47 public:
48 ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
49 void oops_do(OopClosure* cl, uint worker_id);
50 };
51
52 class ShenandoahSerialRoots {
53 private:
54 ShenandoahSerialRoot _universe_root;
55 ShenandoahSerialRoot _object_synchronizer_root;
56 ShenandoahSerialRoot _management_root;
57 ShenandoahSerialRoot _system_dictionary_root;
58 ShenandoahSerialRoot _jvmti_root;
59 public:
60 ShenandoahSerialRoots();
61 void oops_do(OopClosure* cl, uint worker_id);
62 };
63
64 template <bool CONCURRENT = false>
65 class ShenandoahJNIHandleRoots {
66 private:
67 volatile bool _claimed;
68 OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
69 public:
70 ShenandoahJNIHandleRoots();
71
72 template <typename T>
73 void oops_do(T* cl, uint worker_id = 0);
74 };
75
76 class ShenandoahThreadRoots {
77 private:
78 const bool _is_par;
79 public:
80 ShenandoahThreadRoots(bool is_par);
81 ~ShenandoahThreadRoots();
82
83 void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
84 void threads_do(ThreadClosure* tc, uint worker_id);
85 };
86
87 class ShenandoahWeakRoots {
88 private:
89 WeakProcessorPhaseTimes _process_timings;
90 WeakProcessor::Task _task;
91 public:
92 ShenandoahWeakRoots(uint n_workers);
93 ~ShenandoahWeakRoots();
98
99 class ShenandoahStringDedupRoots {
100 public:
101 ShenandoahStringDedupRoots();
102 ~ShenandoahStringDedupRoots();
103
104 void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
105 };
106
107 template <typename ITR>
108 class ShenandoahCodeCacheRoots {
109 private:
110 ITR _coderoots_iterator;
111 public:
112 ShenandoahCodeCacheRoots();
113 ~ShenandoahCodeCacheRoots();
114
115 void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
116 };
117
118 template <bool CONCURRENT = false>
119 class ShenandoahClassLoaderDataRoots {
120 public:
121 ShenandoahClassLoaderDataRoots();
122 ~ShenandoahClassLoaderDataRoots();
123
124 void always_strong_cld_do(CLDClosure* clds, uint worker_id = 0);
125 void cld_do(CLDClosure* clds, uint worker_id = 0);
126 };
127
128 class ShenandoahRootProcessor : public StackObj {
129 private:
130 ShenandoahHeap* const _heap;
131 const ShenandoahPhaseTimings::Phase _phase;
132 public:
133 ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase);
134 ~ShenandoahRootProcessor();
135
136 ShenandoahHeap* heap() const { return _heap; }
137 };
138
139 template <typename ITR>
140 class ShenandoahRootScanner : public ShenandoahRootProcessor {
141 private:
142 ShenandoahSerialRoots _serial_roots;
143 ShenandoahJNIHandleRoots<> _jni_roots;
144 ShenandoahClassLoaderDataRoots<> _cld_roots;
145 ShenandoahThreadRoots _thread_roots;
146 ShenandoahCodeCacheRoots<ITR> _code_roots;
147 public:
148 ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
149
150 // Apply oops, clds and blobs to all strongly reachable roots in the system,
151 // during class unloading cycle
152 void strong_roots_do(uint worker_id, OopClosure* cl);
153 void strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
154
155 // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
156 // roots when class unloading is disabled during this cycle
157 void roots_do(uint worker_id, OopClosure* cl);
158 void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
159 // For heap object iteration
160 void roots_do_unchecked(OopClosure* cl);
161 void strong_roots_do_unchecked(OopClosure* cl);
162 };
163
164 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
165 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
166
167 // Evacuate all roots at a safepoint
168 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
169 private:
170 ShenandoahSerialRoots _serial_roots;
171 ShenandoahJNIHandleRoots<> _jni_roots;
172 ShenandoahClassLoaderDataRoots<> _cld_roots;
173 ShenandoahThreadRoots _thread_roots;
174 ShenandoahWeakRoots _weak_roots;
175 ShenandoahStringDedupRoots _dedup_roots;
176 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
177 bool _include_concurrent_roots;
178
179 public:
180 ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
181
182 void roots_do(uint worker_id, OopClosure* oops);
183 };
184
185 // Update all roots at a safepoint
186 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
187 private:
188 ShenandoahSerialRoots _serial_roots;
189 ShenandoahJNIHandleRoots<> _jni_roots;
190 ShenandoahClassLoaderDataRoots<> _cld_roots;
191 ShenandoahThreadRoots _thread_roots;
192 ShenandoahWeakRoots _weak_roots;
193 ShenandoahStringDedupRoots _dedup_roots;
194 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
195 const bool _update_code_cache;
196
197 public:
198 ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
199
200 template<typename IsAlive, typename KeepAlive>
201 void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
202 };
203
204 // Adjuster all roots at a safepoint during full gc
205 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
206 private:
207 ShenandoahSerialRoots _serial_roots;
208 ShenandoahJNIHandleRoots<> _jni_roots;
209 ShenandoahClassLoaderDataRoots<> _cld_roots;
210 ShenandoahThreadRoots _thread_roots;
211 ShenandoahWeakRoots _weak_roots;
212 ShenandoahStringDedupRoots _dedup_roots;
213 ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
214
215 public:
216 ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
217
218 void roots_do(uint worker_id, OopClosure* oops);
219 };
220
221 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
|