< prev index next >

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

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
  27 
  28 #include "gc/g1/heapRegionSet.hpp"
  29 
  30 inline void HeapRegionSetBase::add(HeapRegion* hr) {
  31   check_mt_safety();
  32   assert_heap_region_set(hr->containing_set() == NULL, "should not already have a containing set");
  33   assert_heap_region_set(hr->next() == NULL, "should not already be linked");
  34   assert_heap_region_set(hr->prev() == NULL, "should not already be linked");
  35 
  36   _count.increment(1u, hr->capacity());
  37   hr->set_containing_set(this);
  38   verify_region(hr);
  39 }
  40 
  41 inline void HeapRegionSetBase::remove(HeapRegion* hr) {
  42   check_mt_safety();
  43   verify_region(hr);
  44   assert_heap_region_set(hr->next() == NULL, "should already be unlinked");
  45   assert_heap_region_set(hr->prev() == NULL, "should already be unlinked");
  46 
  47   hr->set_containing_set(NULL);
  48   assert_heap_region_set(_count.length() > 0, "pre-condition");
  49   _count.decrement(1u, hr->capacity());
  50 }
  51 
  52 inline void FreeRegionList::add_ordered(HeapRegion* hr) {
  53   assert_free_region_list((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) ||
  54                           (length() >  0 && _head != NULL && _tail != NULL),
  55                           "invariant");
  56   // add() will verify the region and check mt safety.
  57   add(hr);
  58 
  59   // Now link the region
  60   if (_head != NULL) {
  61     HeapRegion* curr;
  62 
  63     if (_last != NULL && _last->hrm_index() < hr->hrm_index()) {
  64       curr = _last;
  65     } else {
  66       curr = _head;
  67     }
  68 
  69     // Find first entry with a Region Index larger than entry to insert.




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGIONSET_INLINE_HPP
  27 
  28 #include "gc/g1/heapRegionSet.hpp"
  29 
  30 inline void HeapRegionSetBase::add(HeapRegion* hr) {
  31   check_mt_safety();
  32   assert_heap_region_set(hr->containing_set() == NULL, "should not already have a containing set");
  33   assert_heap_region_set(hr->next() == NULL, "should not already be linked");
  34   assert_heap_region_set(hr->prev() == NULL, "should not already be linked");
  35 
  36   _length++;
  37   hr->set_containing_set(this);
  38   verify_region(hr);
  39 }
  40 
  41 inline void HeapRegionSetBase::remove(HeapRegion* hr) {
  42   check_mt_safety();
  43   verify_region(hr);
  44   assert_heap_region_set(hr->next() == NULL, "should already be unlinked");
  45   assert_heap_region_set(hr->prev() == NULL, "should already be unlinked");
  46 
  47   hr->set_containing_set(NULL);
  48   assert_heap_region_set(_length > 0, "pre-condition");
  49   _length--;
  50 }
  51 
  52 inline void FreeRegionList::add_ordered(HeapRegion* hr) {
  53   assert_free_region_list((length() == 0 && _head == NULL && _tail == NULL && _last == NULL) ||
  54                           (length() >  0 && _head != NULL && _tail != NULL),
  55                           "invariant");
  56   // add() will verify the region and check mt safety.
  57   add(hr);
  58 
  59   // Now link the region
  60   if (_head != NULL) {
  61     HeapRegion* curr;
  62 
  63     if (_last != NULL && _last->hrm_index() < hr->hrm_index()) {
  64       curr = _last;
  65     } else {
  66       curr = _head;
  67     }
  68 
  69     // Find first entry with a Region Index larger than entry to insert.


< prev index next >