187 public:
188 AllocateList(const AllocateEntry& (*get_entry)(const Block& block));
189 ~AllocateList();
190
191 Block* head();
192 Block* tail();
193 const Block* chead() const;
194 const Block* ctail() const;
195
196 Block* prev(Block& block);
197 Block* next(Block& block);
198
199 const Block* prev(const Block& block) const;
200 const Block* next(const Block& block) const;
201
202 void push_front(const Block& block);
203 void push_back(const Block& block);
204 void unlink(const Block& block);
205 };
206
207 // RCU-inspired protection of access to _active_array.
208 class ProtectActive {
209 volatile uint _enter;
210 volatile uint _exit[2];
211
212 public:
213 ProtectActive();
214
215 uint read_enter();
216 void read_exit(uint enter_value);
217 void write_synchronize();
218 };
219
220 private:
221 const char* _name;
222 ActiveArray* _active_array;
223 AllocateList _allocate_list;
224 Block* volatile _deferred_updates;
225
226 Mutex* _allocate_mutex;
227 Mutex* _active_mutex;
228
229 // Volatile for racy unlocked accesses.
230 volatile size_t _allocation_count;
231
232 // Protection for _active_array.
233 mutable ProtectActive _protect_active;
234
235 // mutable because this gets set even for const iteration.
236 mutable bool _concurrent_iteration_active;
237
238 Block* find_block_or_null(const oop* ptr) const;
239 void delete_empty_block(const Block& block);
240 bool reduce_deferred_updates();
241
242 // Managing _active_array.
243 bool expand_active_array();
244 void replace_active_array(ActiveArray* new_array);
245 ActiveArray* obtain_active_array() const;
246 void relinquish_block_array(ActiveArray* array) const;
247 class WithActiveArray; // RAII helper for active array access.
248
249 template<typename F, typename Storage>
250 static bool iterate_impl(F f, Storage* storage);
251
252 // Implementation support for parallel iteration
253 class BasicParState;
|
187 public:
188 AllocateList(const AllocateEntry& (*get_entry)(const Block& block));
189 ~AllocateList();
190
191 Block* head();
192 Block* tail();
193 const Block* chead() const;
194 const Block* ctail() const;
195
196 Block* prev(Block& block);
197 Block* next(Block& block);
198
199 const Block* prev(const Block& block) const;
200 const Block* next(const Block& block) const;
201
202 void push_front(const Block& block);
203 void push_back(const Block& block);
204 void unlink(const Block& block);
205 };
206
207 private:
208 const char* _name;
209 ActiveArray* _active_array;
210 AllocateList _allocate_list;
211 Block* volatile _deferred_updates;
212
213 Mutex* _allocate_mutex;
214 Mutex* _active_mutex;
215
216 // Volatile for racy unlocked accesses.
217 volatile size_t _allocation_count;
218
219 // mutable because this gets set even for const iteration.
220 mutable bool _concurrent_iteration_active;
221
222 Block* find_block_or_null(const oop* ptr) const;
223 void delete_empty_block(const Block& block);
224 bool reduce_deferred_updates();
225
226 // Managing _active_array.
227 bool expand_active_array();
228 void replace_active_array(ActiveArray* new_array);
229 ActiveArray* obtain_active_array() const;
230 void relinquish_block_array(ActiveArray* array) const;
231 class WithActiveArray; // RAII helper for active array access.
232
233 template<typename F, typename Storage>
234 static bool iterate_impl(F f, Storage* storage);
235
236 // Implementation support for parallel iteration
237 class BasicParState;
|