163 void add(NodeInfo* info); 164 }; 165 166 HeapRegion* _head; 167 HeapRegion* _tail; 168 169 // _last is used to keep track of where we added an element the last 170 // time. It helps to improve performance when adding several ordered items in a row. 171 HeapRegion* _last; 172 173 NodeInfo* _node_info; 174 175 static uint _unrealistically_long_length; 176 177 inline HeapRegion* remove_from_head_impl(); 178 inline HeapRegion* remove_from_tail_impl(); 179 180 inline void increase_length(uint node_index); 181 inline void decrease_length(uint node_index); 182 183 protected: 184 // See the comment for HeapRegionSetBase::clear() 185 virtual void clear(); 186 187 public: 188 FreeRegionList(const char* name, HeapRegionSetChecker* checker = NULL); 189 ~FreeRegionList(); 190 191 void verify_list(); 192 193 #ifdef ASSERT 194 bool contains(HeapRegion* hr) const { 195 return hr->containing_set() == this; 196 } 197 #endif 198 199 static void set_unrealistically_long_length(uint len); 200 201 // Add hr to the list. The region should not be a member of another set. 202 // Assumes that the list is ordered and will preserve that order. The order 203 // is determined by hrm_index. 204 inline void add_ordered(HeapRegion* hr); 205 206 // Removes from head or tail based on the given argument. 207 HeapRegion* remove_region(bool from_head); 208 209 HeapRegion* remove_region_with_node_index(bool from_head, 210 uint requested_node_index); 211 212 // Merge two ordered lists. The result is also ordered. The order is 213 // determined by hrm_index. 214 void add_ordered(FreeRegionList* from_list); 215 216 // It empties the list by removing all regions from it. 217 void remove_all(); 218 219 // Remove all (contiguous) regions from first to first + num_regions -1 from 220 // this list. 221 // Num_regions must be > 1. 222 void remove_starting_at(HeapRegion* first, uint num_regions); 223 224 virtual void verify(); 225 226 uint num_of_regions_in_range(uint start, uint end) const; 227 228 using HeapRegionSetBase::length; 229 uint length(uint node_index) const; 230 }; 231 232 // Iterator class that provides a convenient way to iterate over the 233 // regions of a FreeRegionList. 234 235 class FreeRegionListIterator : public StackObj { 236 private: 237 FreeRegionList* _list; | 163 void add(NodeInfo* info); 164 }; 165 166 HeapRegion* _head; 167 HeapRegion* _tail; 168 169 // _last is used to keep track of where we added an element the last 170 // time. It helps to improve performance when adding several ordered items in a row. 171 HeapRegion* _last; 172 173 NodeInfo* _node_info; 174 175 static uint _unrealistically_long_length; 176 177 inline HeapRegion* remove_from_head_impl(); 178 inline HeapRegion* remove_from_tail_impl(); 179 180 inline void increase_length(uint node_index); 181 inline void decrease_length(uint node_index); 182 183 // Common checks for adding a list. 184 void add_list_common_start(FreeRegionList* from_list); 185 void add_list_common_end(FreeRegionList* from_list); 186 187 protected: 188 // See the comment for HeapRegionSetBase::clear() 189 virtual void clear(); 190 191 public: 192 FreeRegionList(const char* name, HeapRegionSetChecker* checker = NULL); 193 ~FreeRegionList(); 194 195 void verify_list(); 196 197 #ifdef ASSERT 198 bool contains(HeapRegion* hr) const { 199 return hr->containing_set() == this; 200 } 201 #endif 202 203 static void set_unrealistically_long_length(uint len); 204 205 // Add hr to the list. The region should not be a member of another set. 206 // Assumes that the list is ordered and will preserve that order. The order 207 // is determined by hrm_index. 208 inline void add_ordered(HeapRegion* hr); 209 // Same restrictions as above, but adds the region last in the list. 210 inline void add_to_tail(HeapRegion* region_to_add); 211 212 // Removes from head or tail based on the given argument. 213 HeapRegion* remove_region(bool from_head); 214 215 HeapRegion* remove_region_with_node_index(bool from_head, 216 uint requested_node_index); 217 218 // Merge two ordered lists. The result is also ordered. The order is 219 // determined by hrm_index. 220 void add_ordered(FreeRegionList* from_list); 221 void append_ordered(FreeRegionList* from_list); 222 223 // It empties the list by removing all regions from it. 224 void remove_all(); 225 226 // Abandon current free list. Requires that all regions in the current list 227 // are taken care of separately, to allow a rebuild. 228 void abandon(); 229 230 // Remove all (contiguous) regions from first to first + num_regions -1 from 231 // this list. 232 // Num_regions must be > 1. 233 void remove_starting_at(HeapRegion* first, uint num_regions); 234 235 virtual void verify(); 236 237 uint num_of_regions_in_range(uint start, uint end) const; 238 239 using HeapRegionSetBase::length; 240 uint length(uint node_index) const; 241 }; 242 243 // Iterator class that provides a convenient way to iterate over the 244 // regions of a FreeRegionList. 245 246 class FreeRegionListIterator : public StackObj { 247 private: 248 FreeRegionList* _list; |