src/share/vm/memory/freeList.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-g1-mmap Sdiff src/share/vm/memory

src/share/vm/memory/freeList.cpp

Print this page




  38 #endif // INCLUDE_ALL_GCS
  39 
  40 // Free list.  A FreeList is used to access a linked list of chunks
  41 // of space in the heap.  The head and tail are maintained so that
  42 // items can be (as in the current implementation) added at the
  43 // at the tail of the list and removed from the head of the list to
  44 // maintain a FIFO queue.
  45 
  46 template <class Chunk>
  47 FreeList<Chunk>::FreeList() :
  48   _head(NULL), _tail(NULL)
  49 #ifdef ASSERT
  50   , _protecting_lock(NULL)
  51 #endif
  52 {
  53   _size         = 0;
  54   _count        = 0;
  55 }
  56 
  57 template <class Chunk>
  58 FreeList<Chunk>::FreeList(Chunk* fc) :
  59   _head(fc), _tail(fc)
  60 #ifdef ASSERT
  61   , _protecting_lock(NULL)
  62 #endif
  63 {
  64   _size         = fc->size();
  65   _count        = 1;
  66 }
  67 
  68 template <class Chunk>
  69 void FreeList<Chunk>::link_head(Chunk* v) {
  70   assert_proper_lock_protection();
  71   set_head(v);
  72   // If this method is not used (just set the head instead),
  73   // this check can be avoided.
  74   if (v != NULL) {
  75     v->link_prev(NULL);
  76   }
  77 }
  78 
  79 
  80 
  81 template <class Chunk>
  82 void FreeList<Chunk>::reset() {
  83   // Don't set the _size to 0 because this method is
  84   // used with a existing list that has a size but which has
  85   // been emptied.
  86   // Don't clear the _protecting_lock of an existing list.
  87   set_count(0);
  88   set_head(NULL);




  38 #endif // INCLUDE_ALL_GCS
  39 
  40 // Free list.  A FreeList is used to access a linked list of chunks
  41 // of space in the heap.  The head and tail are maintained so that
  42 // items can be (as in the current implementation) added at the
  43 // at the tail of the list and removed from the head of the list to
  44 // maintain a FIFO queue.
  45 
  46 template <class Chunk>
  47 FreeList<Chunk>::FreeList() :
  48   _head(NULL), _tail(NULL)
  49 #ifdef ASSERT
  50   , _protecting_lock(NULL)
  51 #endif
  52 {
  53   _size         = 0;
  54   _count        = 0;
  55 }
  56 
  57 template <class Chunk>











  58 void FreeList<Chunk>::link_head(Chunk* v) {
  59   assert_proper_lock_protection();
  60   set_head(v);
  61   // If this method is not used (just set the head instead),
  62   // this check can be avoided.
  63   if (v != NULL) {
  64     v->link_prev(NULL);
  65   }
  66 }
  67 
  68 
  69 
  70 template <class Chunk>
  71 void FreeList<Chunk>::reset() {
  72   // Don't set the _size to 0 because this method is
  73   // used with a existing list that has a size but which has
  74   // been emptied.
  75   // Don't clear the _protecting_lock of an existing list.
  76   set_count(0);
  77   set_head(NULL);


src/share/vm/memory/freeList.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File