233 // Assumes that the list is ordered and will preserve that order. The order 234 // is determined by hrm_index. 235 inline void add_ordered(HeapRegion* hr); 236 237 // Removes from head or tail based on the given argument. 238 HeapRegion* remove_region(bool from_head); 239 240 // Merge two ordered lists. The result is also ordered. The order is 241 // determined by hrm_index. 242 void add_ordered(FreeRegionList* from_list); 243 244 // It empties the list by removing all regions from it. 245 void remove_all(); 246 247 // Remove all (contiguous) regions from first to first + num_regions -1 from 248 // this list. 249 // Num_regions must be > 1. 250 void remove_starting_at(HeapRegion* first, uint num_regions); 251 252 virtual void verify(); 253 254 virtual void print_on(outputStream* out, bool print_contents = false); 255 }; 256 257 // Iterator class that provides a convenient way to iterate over the 258 // regions of a FreeRegionList. 259 260 class FreeRegionListIterator : public StackObj { 261 private: 262 FreeRegionList* _list; 263 HeapRegion* _curr; 264 265 public: 266 bool more_available() { 267 return _curr != NULL; 268 } 269 270 HeapRegion* get_next() { 271 assert(more_available(), 272 "get_next() should be called when more regions are available"); 273 274 // If we are going to introduce a count in the iterator we should | 233 // Assumes that the list is ordered and will preserve that order. The order 234 // is determined by hrm_index. 235 inline void add_ordered(HeapRegion* hr); 236 237 // Removes from head or tail based on the given argument. 238 HeapRegion* remove_region(bool from_head); 239 240 // Merge two ordered lists. The result is also ordered. The order is 241 // determined by hrm_index. 242 void add_ordered(FreeRegionList* from_list); 243 244 // It empties the list by removing all regions from it. 245 void remove_all(); 246 247 // Remove all (contiguous) regions from first to first + num_regions -1 from 248 // this list. 249 // Num_regions must be > 1. 250 void remove_starting_at(HeapRegion* first, uint num_regions); 251 252 virtual void verify(); 253 }; 254 255 // Iterator class that provides a convenient way to iterate over the 256 // regions of a FreeRegionList. 257 258 class FreeRegionListIterator : public StackObj { 259 private: 260 FreeRegionList* _list; 261 HeapRegion* _curr; 262 263 public: 264 bool more_available() { 265 return _curr != NULL; 266 } 267 268 HeapRegion* get_next() { 269 assert(more_available(), 270 "get_next() should be called when more regions are available"); 271 272 // If we are going to introduce a count in the iterator we should |