150 // Parallel iteration is for the exclusive use of the GC. |
150 // Parallel iteration is for the exclusive use of the GC. |
151 // Other clients must use serial iteration. |
151 // Other clients must use serial iteration. |
152 template<bool concurrent, bool is_const> class ParState; |
152 template<bool concurrent, bool is_const> class ParState; |
153 |
153 |
154 // Service thread cleanup support. |
154 // Service thread cleanup support. |
155 // Stops deleting if there is an in-progress concurrent iteration. |
155 |
156 // Locks both the _allocation_mutex and the _active_mutex, and may |
156 // Called by the service thread to process any pending cleanups for this |
157 // safepoint. Deletion may be throttled, with only some available |
157 // storage object. Drains the _deferred_updates list, and deletes empty |
158 // work performed, in order to allow other Service thread subtasks |
158 // blocks. Stops deleting if there is an in-progress concurrent |
159 // to run. Returns true if there may be more work to do, false if |
159 // iteration. Locks both the _allocation_mutex and the _active_mutex, and |
160 // nothing to do. |
160 // may safepoint. Deletion may be throttled, with only some available |
|
161 // work performed, in order to allow other Service thread subtasks to run. |
|
162 // Returns true if there may be more work to do, false if nothing to do. |
161 bool delete_empty_blocks(); |
163 bool delete_empty_blocks(); |
162 |
164 |
163 // Service thread cleanup support. |
165 // Called by safepoint cleanup to notify the service thread (via |
164 // Called by the service thread (while holding Service_lock) to test |
166 // Service_lock) that there may be some OopStorage objects with pending |
165 // whether a call to delete_empty_blocks should be made. |
167 // cleanups to process. |
166 bool needs_delete_empty_blocks() const; |
168 static void trigger_cleanup_if_needed(); |
|
169 |
|
170 // Called by the service thread (while holding Service_lock) to to test |
|
171 // for pending cleanup requests, and resets the request state to allow |
|
172 // recognition of new requests. Returns true if there was a pending |
|
173 // request. |
|
174 static bool has_cleanup_work_and_reset(); |
167 |
175 |
168 // Debugging and logging support. |
176 // Debugging and logging support. |
169 const char* name() const; |
177 const char* name() const; |
170 void print_on(outputStream* st) const PRODUCT_RETURN; |
178 void print_on(outputStream* st) const PRODUCT_RETURN; |
171 |
179 |
230 mutable SingleWriterSynchronizer _protect_active; |
238 mutable SingleWriterSynchronizer _protect_active; |
231 |
239 |
232 // mutable because this gets set even for const iteration. |
240 // mutable because this gets set even for const iteration. |
233 mutable int _concurrent_iteration_count; |
241 mutable int _concurrent_iteration_count; |
234 |
242 |
235 volatile uint _needs_cleanup; |
243 volatile bool _needs_cleanup; |
236 |
244 |
237 bool try_add_block(); |
245 bool try_add_block(); |
238 Block* block_for_allocation(); |
246 Block* block_for_allocation(); |
239 |
247 |
240 Block* find_block_or_null(const oop* ptr) const; |
248 Block* find_block_or_null(const oop* ptr) const; |
241 void delete_empty_block(const Block& block); |
249 void delete_empty_block(const Block& block); |
242 bool reduce_deferred_updates(); |
250 bool reduce_deferred_updates(); |
243 void notify_needs_cleanup(); |
|
244 AIX_ONLY(public:) // xlC 12 on AIX doesn't implement C++ DR45. |
251 AIX_ONLY(public:) // xlC 12 on AIX doesn't implement C++ DR45. |
245 void record_needs_cleanup(); |
252 void record_needs_cleanup(); |
246 AIX_ONLY(private:) |
253 AIX_ONLY(private:) |
247 |
254 |
248 // Managing _active_array. |
255 // Managing _active_array. |