index

src/share/vm/memory/freeList.hpp

Print this page
rev 7214 : imported patch rev3
rev 7216 : [mq]: rev5


  39 // See the corresponding .cpp file for a description of the specifics
  40 // for that implementation.
  41 
  42 class Mutex;
  43 
  44 template <class Chunk_t>
  45 class FreeList VALUE_OBJ_CLASS_SPEC {
  46   friend class CompactibleFreeListSpace;
  47   friend class VMStructs;
  48 
  49  private:
  50   Chunk_t*      _head;          // Head of list of free chunks
  51   Chunk_t*      _tail;          // Tail of list of free chunks
  52   size_t        _size;          // Size in Heap words of each chunk
  53   ssize_t       _count;         // Number of entries in list
  54 
  55  protected:
  56 
  57 #ifdef ASSERT
  58   Mutex*        _protecting_lock;

  59 #endif
  60 
  61   // Asserts false if the protecting lock (if any) is not held.
  62   void assert_proper_lock_protection() const;


  63 
  64   void increment_count()    {
  65     _count++;
  66   }
  67 
  68   void decrement_count() {
  69     _count--;
  70     assert(_count >= 0, "Count should not be negative");
  71   }
  72 
  73  public:
  74   // Constructor
  75   // Construct a list without any entries.
  76   FreeList();
  77 
  78   // Do initialization
  79   void initialize();
  80 
  81   // Reset the head, tail, and count of a free list.
  82   void reset();




  39 // See the corresponding .cpp file for a description of the specifics
  40 // for that implementation.
  41 
  42 class Mutex;
  43 
  44 template <class Chunk_t>
  45 class FreeList VALUE_OBJ_CLASS_SPEC {
  46   friend class CompactibleFreeListSpace;
  47   friend class VMStructs;
  48 
  49  private:
  50   Chunk_t*      _head;          // Head of list of free chunks
  51   Chunk_t*      _tail;          // Tail of list of free chunks
  52   size_t        _size;          // Size in Heap words of each chunk
  53   ssize_t       _count;         // Number of entries in list
  54 
  55  protected:
  56 
  57 #ifdef ASSERT
  58   Mutex*        _protecting_lock;
  59   void assert_proper_lock_protection_work() const;
  60 #endif
  61 
  62   // Asserts false if the protecting lock (if any) is not held.
  63   void assert_proper_lock_protection() const {
  64     DEBUG_ONLY(assert_proper_lock_protection_work());
  65   }
  66 
  67   void increment_count()    {
  68     _count++;
  69   }
  70 
  71   void decrement_count() {
  72     _count--;
  73     assert(_count >= 0, "Count should not be negative");
  74   }
  75 
  76  public:
  77   // Constructor
  78   // Construct a list without any entries.
  79   FreeList();
  80 
  81   // Do initialization
  82   void initialize();
  83 
  84   // Reset the head, tail, and count of a free list.
  85   void reset();


index