< prev index next >

src/hotspot/share/gc/g1/heapRegionSet.inline.hpp

Print this page
rev 56821 : imported patch 8220310.mut.0
rev 56822 : imported patch 8220310.mut.1
rev 56823 : imported patch 8220310.mut.2
rev 56824 : imported patch 8220310.mut.3
rev 56825 : imported patch 8220310.mut.4
rev 56834 : imported patch 8220312.stat.2
rev 56836 : imported patch 8220312.stat.4
rev 56838 : [mq]: 8220312.stat.5


  78       // Adding at the end
  79       hr->set_prev(_tail);
  80       _tail->set_next(hr);
  81       _tail = hr;
  82     } else if (curr->prev() == NULL) {
  83       // Adding at the beginning
  84       hr->set_prev(NULL);
  85       _head = hr;
  86       curr->set_prev(hr);
  87     } else {
  88       hr->set_prev(curr->prev());
  89       hr->prev()->set_next(hr);
  90       curr->set_prev(hr);
  91     }
  92   } else {
  93     // The list was empty
  94     _tail = hr;
  95     _head = hr;
  96   }
  97   _last = hr;


  98 }
  99 
 100 inline HeapRegion* FreeRegionList::remove_from_head_impl() {
 101   HeapRegion* result = _head;
 102   _head = result->next();
 103   if (_head == NULL) {
 104     _tail = NULL;
 105   } else {
 106     _head->set_prev(NULL);
 107   }
 108   result->set_next(NULL);
 109   return result;
 110 }
 111 
 112 inline HeapRegion* FreeRegionList::remove_from_tail_impl() {
 113   HeapRegion* result = _tail;
 114 
 115   _tail = result->prev();
 116   if (_tail == NULL) {
 117     _head = NULL;


 128 
 129   if (is_empty()) {
 130     return NULL;
 131   }
 132   assert_free_region_list(length() > 0 && _head != NULL && _tail != NULL, "invariant");
 133 
 134   HeapRegion* hr;
 135 
 136   if (from_head) {
 137     hr = remove_from_head_impl();
 138   } else {
 139     hr = remove_from_tail_impl();
 140   }
 141 
 142   if (_last == hr) {
 143     _last = NULL;
 144   }
 145 
 146   // remove() will verify the region and check mt safety.
 147   remove(hr);



 148   return hr;
 149 }
 150 
 151 inline HeapRegion* FreeRegionList::remove_region_with_node_index(bool from_head,
 152                                                                  const uint requested_node_index,
 153                                                                  uint* allocated_node_index) {
 154   assert(UseNUMA, "Invariant");
 155 
 156   const uint max_search_depth = G1NUMA::numa()->max_search_depth();
 157   HeapRegion* cur;
 158 
 159   // Find the region to use, searching from _head or _tail as requested.
 160   size_t cur_depth = 0;
 161   if (from_head) {
 162     for (cur = _head;
 163          cur != NULL && cur_depth < max_search_depth;
 164          cur = cur->next(), ++cur_depth) {
 165       if (requested_node_index == cur->node_index()) {
 166         break;
 167       }
 168     }
 169   } else {
 170     for (cur = _tail;
 171          cur != NULL && cur_depth < max_search_depth;
 172          cur = cur->prev(), ++cur_depth) {
 173       if (requested_node_index == cur->node_index()) {


 185   HeapRegion* prev = cur->prev();
 186   HeapRegion* next = cur->next();
 187   if (prev == NULL) {
 188     _head = next;
 189   } else {
 190     prev->set_next(next);
 191   }
 192   if (next == NULL) {
 193     _tail = prev;
 194   } else {
 195     next->set_prev(prev);
 196   }
 197   cur->set_prev(NULL);
 198   cur->set_next(NULL);
 199 
 200   if (_last == cur) {
 201     _last = NULL;
 202   }
 203 
 204   remove(cur);
 205   if (allocated_node_index != NULL) {
 206     *allocated_node_index = cur->node_index();
 207   }
 208 
 209   return cur;







































 210 }
 211 
 212 #endif // SHARE_GC_G1_HEAPREGIONSET_INLINE_HPP


  78       // Adding at the end
  79       hr->set_prev(_tail);
  80       _tail->set_next(hr);
  81       _tail = hr;
  82     } else if (curr->prev() == NULL) {
  83       // Adding at the beginning
  84       hr->set_prev(NULL);
  85       _head = hr;
  86       curr->set_prev(hr);
  87     } else {
  88       hr->set_prev(curr->prev());
  89       hr->prev()->set_next(hr);
  90       curr->set_prev(hr);
  91     }
  92   } else {
  93     // The list was empty
  94     _tail = hr;
  95     _head = hr;
  96   }
  97   _last = hr;
  98 
  99   increase_length(hr->node_index());
 100 }
 101 
 102 inline HeapRegion* FreeRegionList::remove_from_head_impl() {
 103   HeapRegion* result = _head;
 104   _head = result->next();
 105   if (_head == NULL) {
 106     _tail = NULL;
 107   } else {
 108     _head->set_prev(NULL);
 109   }
 110   result->set_next(NULL);
 111   return result;
 112 }
 113 
 114 inline HeapRegion* FreeRegionList::remove_from_tail_impl() {
 115   HeapRegion* result = _tail;
 116 
 117   _tail = result->prev();
 118   if (_tail == NULL) {
 119     _head = NULL;


 130 
 131   if (is_empty()) {
 132     return NULL;
 133   }
 134   assert_free_region_list(length() > 0 && _head != NULL && _tail != NULL, "invariant");
 135 
 136   HeapRegion* hr;
 137 
 138   if (from_head) {
 139     hr = remove_from_head_impl();
 140   } else {
 141     hr = remove_from_tail_impl();
 142   }
 143 
 144   if (_last == hr) {
 145     _last = NULL;
 146   }
 147 
 148   // remove() will verify the region and check mt safety.
 149   remove(hr);
 150 
 151   decrease_length(hr->node_index());
 152 
 153   return hr;
 154 }
 155 
 156 inline HeapRegion* FreeRegionList::remove_region_with_node_index(bool from_head,
 157                                                                  uint requested_node_index) {

 158   assert(UseNUMA, "Invariant");
 159 
 160   const uint max_search_depth = G1NUMA::numa()->max_search_depth();
 161   HeapRegion* cur;
 162 
 163   // Find the region to use, searching from _head or _tail as requested.
 164   size_t cur_depth = 0;
 165   if (from_head) {
 166     for (cur = _head;
 167          cur != NULL && cur_depth < max_search_depth;
 168          cur = cur->next(), ++cur_depth) {
 169       if (requested_node_index == cur->node_index()) {
 170         break;
 171       }
 172     }
 173   } else {
 174     for (cur = _tail;
 175          cur != NULL && cur_depth < max_search_depth;
 176          cur = cur->prev(), ++cur_depth) {
 177       if (requested_node_index == cur->node_index()) {


 189   HeapRegion* prev = cur->prev();
 190   HeapRegion* next = cur->next();
 191   if (prev == NULL) {
 192     _head = next;
 193   } else {
 194     prev->set_next(next);
 195   }
 196   if (next == NULL) {
 197     _tail = prev;
 198   } else {
 199     next->set_prev(prev);
 200   }
 201   cur->set_prev(NULL);
 202   cur->set_next(NULL);
 203 
 204   if (_last == cur) {
 205     _last = NULL;
 206   }
 207 
 208   remove(cur);
 209   decrease_length(cur->node_index());


 210 
 211   return cur;
 212 }
 213 
 214 inline void FreeRegionList::NodeInfo::increase_length(uint node_index) {
 215   if (node_index < _num_nodes) {
 216     _length_of_node[node_index] += 1;
 217   }
 218 }
 219 
 220 inline void FreeRegionList::NodeInfo::decrease_length(uint node_index) {
 221   if (node_index < _num_nodes) {
 222     assert(_length_of_node[node_index] > 0,
 223            "Current length %u should be greater than zero for node %u",
 224            _length_of_node[node_index], node_index);
 225     _length_of_node[node_index] -= 1;
 226   }
 227 }
 228 
 229 inline uint FreeRegionList::NodeInfo::length(uint node_index) const {
 230   return _length_of_node[node_index];
 231 }
 232 
 233 inline void FreeRegionList::increase_length(uint node_index) {
 234   if (_node_info != NULL) {
 235     return _node_info->increase_length(node_index);
 236   }
 237 }
 238 
 239 inline void FreeRegionList::decrease_length(uint node_index) {
 240   if (_node_info != NULL) {
 241     return _node_info->decrease_length(node_index);
 242   }
 243 }
 244 
 245 inline uint FreeRegionList::length(uint node_index) const {
 246   if (_node_info != NULL) {
 247     return _node_info->length(node_index);
 248   } else {
 249     return 0;
 250   }
 251 }
 252 
 253 #endif // SHARE_GC_G1_HEAPREGIONSET_INLINE_HPP
< prev index next >