163 // a) to return a different value than was returned before the last |
163 // a) to return a different value than was returned before the last |
164 // call to change_strong_roots_parity, and |
164 // call to change_strong_roots_parity, and |
165 // c) to never return a distinguished value (zero) with which such |
165 // c) to never return a distinguished value (zero) with which such |
166 // task-claiming variables may be initialized, to indicate "never |
166 // task-claiming variables may be initialized, to indicate "never |
167 // claimed". |
167 // claimed". |
|
168 private: |
168 void change_strong_roots_parity(); |
169 void change_strong_roots_parity(); |
|
170 public: |
169 int strong_roots_parity() { return _strong_roots_parity; } |
171 int strong_roots_parity() { return _strong_roots_parity; } |
|
172 |
|
173 // Call these in sequential code around process_strong_roots. |
|
174 // strong_roots_prologue calls change_strong_roots_parity, if |
|
175 // parallel tasks are enabled. |
|
176 class StrongRootsScope : public MarkingCodeBlobClosure::MarkScope { |
|
177 public: |
|
178 StrongRootsScope(SharedHeap* outer, bool activate = true); |
|
179 ~StrongRootsScope(); |
|
180 }; |
|
181 friend class StrongRootsScope; |
170 |
182 |
171 enum ScanningOption { |
183 enum ScanningOption { |
172 SO_None = 0x0, |
184 SO_None = 0x0, |
173 SO_AllClasses = 0x1, |
185 SO_AllClasses = 0x1, |
174 SO_SystemClasses = 0x2, |
186 SO_SystemClasses = 0x2, |
196 // "SO_AllClasses" applies the closure to all entries in the SystemDictionary; |
208 // "SO_AllClasses" applies the closure to all entries in the SystemDictionary; |
197 // "SO_SystemClasses" to all the "system" classes and loaders; |
209 // "SO_SystemClasses" to all the "system" classes and loaders; |
198 // "SO_Symbols" applies the closure to all entries in SymbolsTable; |
210 // "SO_Symbols" applies the closure to all entries in SymbolsTable; |
199 // "SO_Strings" applies the closure to all entries in StringTable; |
211 // "SO_Strings" applies the closure to all entries in StringTable; |
200 // "SO_CodeCache" applies the closure to all elements of the CodeCache. |
212 // "SO_CodeCache" applies the closure to all elements of the CodeCache. |
201 void process_strong_roots(bool collecting_perm_gen, |
213 void process_strong_roots(bool activate_scope, |
|
214 bool collecting_perm_gen, |
202 ScanningOption so, |
215 ScanningOption so, |
203 OopClosure* roots, |
216 OopClosure* roots, |
|
217 CodeBlobClosure* code_roots, |
204 OopsInGenClosure* perm_blk); |
218 OopsInGenClosure* perm_blk); |
205 |
219 |
206 // Apply "blk" to all the weak roots of the system. These include |
220 // Apply "blk" to all the weak roots of the system. These include |
207 // JNI weak roots, the code cache, system dictionary, symbol table, |
221 // JNI weak roots, the code cache, system dictionary, symbol table, |
208 // string table. |
222 // string table. |
209 void process_weak_roots(OopClosure* root_closure, |
223 void process_weak_roots(OopClosure* root_closure, |
|
224 CodeBlobClosure* code_roots, |
210 OopClosure* non_root_closure); |
225 OopClosure* non_root_closure); |
211 |
226 |
212 |
227 |
213 // Like CollectedHeap::collect, but assume that the caller holds the Heap_lock. |
228 // Like CollectedHeap::collect, but assume that the caller holds the Heap_lock. |
214 virtual void collect_locked(GCCause::Cause cause) = 0; |
229 virtual void collect_locked(GCCause::Cause cause) = 0; |