< prev index next >

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

Print this page




  33   assert_heap_region_set(hr->containing_set() == NULL, "should not already have a containing set");
  34   assert_heap_region_set(hr->next() == NULL, "should not already be linked");
  35   assert_heap_region_set(hr->prev() == NULL, "should not already be linked");
  36 
  37   _length++;
  38   hr->set_containing_set(this);
  39   verify_region(hr);
  40 }
  41 
  42 inline void HeapRegionSetBase::remove(HeapRegion* hr) {
  43   check_mt_safety();
  44   verify_region(hr);
  45   assert_heap_region_set(hr->next() == NULL, "should already be unlinked");
  46   assert_heap_region_set(hr->prev() == NULL, "should already be unlinked");
  47 
  48   hr->set_containing_set(NULL);
  49   assert_heap_region_set(_length > 0, "pre-condition");
  50   _length--;
  51 }
  52 




















  53 inline void FreeRegionList::add_ordered(HeapRegion* hr) {
  54   assert_free_region_list((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) ||
  55                           (length() >  0 && _head != NULL && _tail != NULL),
  56                           "invariant");
  57   // add() will verify the region and check mt safety.
  58   add(hr);
  59 
  60   // Now link the region
  61   if (_head != NULL) {
  62     HeapRegion* curr;
  63 
  64     if (_last != NULL && _last->hrm_index() < hr->hrm_index()) {
  65       curr = _last;
  66     } else {
  67       curr = _head;
  68     }
  69 
  70     // Find first entry with a Region Index larger than entry to insert.
  71     while (curr != NULL && curr->hrm_index() < hr->hrm_index()) {
  72       curr = curr->next();




  33   assert_heap_region_set(hr->containing_set() == NULL, "should not already have a containing set");
  34   assert_heap_region_set(hr->next() == NULL, "should not already be linked");
  35   assert_heap_region_set(hr->prev() == NULL, "should not already be linked");
  36 
  37   _length++;
  38   hr->set_containing_set(this);
  39   verify_region(hr);
  40 }
  41 
  42 inline void HeapRegionSetBase::remove(HeapRegion* hr) {
  43   check_mt_safety();
  44   verify_region(hr);
  45   assert_heap_region_set(hr->next() == NULL, "should already be unlinked");
  46   assert_heap_region_set(hr->prev() == NULL, "should already be unlinked");
  47 
  48   hr->set_containing_set(NULL);
  49   assert_heap_region_set(_length > 0, "pre-condition");
  50   _length--;
  51 }
  52 
  53 inline void FreeRegionList::add_to_tail(HeapRegion* region_to_add) {
  54   assert_free_region_list((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) ||
  55                           (length() >  0 && _head != NULL && _tail != NULL && _tail->hrm_index() < region_to_add->hrm_index()),
  56                           "invariant");
  57   // add() will verify the region and check mt safety.
  58   add(region_to_add);
  59 
  60   if (_head != NULL) {
  61     // Link into list, next is already NULL, no need to set.
  62     region_to_add->set_prev(_tail);
  63     _tail->set_next(region_to_add);
  64     _tail = region_to_add;
  65   } else {
  66     // Empty list, this region is now the list.
  67     _head = region_to_add;
  68     _tail = region_to_add;
  69   }
  70   increase_length(region_to_add->node_index());
  71 }
  72 
  73 inline void FreeRegionList::add_ordered(HeapRegion* hr) {
  74   assert_free_region_list((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) ||
  75                           (length() >  0 && _head != NULL && _tail != NULL),
  76                           "invariant");
  77   // add() will verify the region and check mt safety.
  78   add(hr);
  79 
  80   // Now link the region
  81   if (_head != NULL) {
  82     HeapRegion* curr;
  83 
  84     if (_last != NULL && _last->hrm_index() < hr->hrm_index()) {
  85       curr = _last;
  86     } else {
  87       curr = _head;
  88     }
  89 
  90     // Find first entry with a Region Index larger than entry to insert.
  91     while (curr != NULL && curr->hrm_index() < hr->hrm_index()) {
  92       curr = curr->next();


< prev index next >