hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.hpp
changeset 185 cda2a1eb4be5
parent 1 489c9b5090e2
child 578 862a85ed20db
equal deleted inserted replaced
184:a2da5efb871c 185:cda2a1eb4be5
    36 
    36 
    37 class Mutex;
    37 class Mutex;
    38 
    38 
    39 class FreeList VALUE_OBJ_CLASS_SPEC {
    39 class FreeList VALUE_OBJ_CLASS_SPEC {
    40   friend class CompactibleFreeListSpace;
    40   friend class CompactibleFreeListSpace;
       
    41   friend class printTreeCensusClosure;
    41   FreeChunk*    _head;          // List of free chunks
    42   FreeChunk*    _head;          // List of free chunks
    42   FreeChunk*    _tail;          // Tail of list of free chunks
    43   FreeChunk*    _tail;          // Tail of list of free chunks
    43   size_t        _size;          // Size in Heap words of each chunks
    44   size_t        _size;          // Size in Heap words of each chunks
    44   ssize_t       _count;         // Number of entries in list
    45   ssize_t       _count;         // Number of entries in list
    45   size_t        _hint;          // next larger size list with a positive surplus
    46   size_t        _hint;          // next larger size list with a positive surplus
    61 
    62 
    62   // Initialize the allocation statistics.
    63   // Initialize the allocation statistics.
    63  protected:
    64  protected:
    64   void init_statistics();
    65   void init_statistics();
    65   void set_count(ssize_t v) { _count = v;}
    66   void set_count(ssize_t v) { _count = v;}
    66   void increment_count() { _count++; }
    67   void increment_count()    { _count++; }
    67   void decrement_count() {
    68   void decrement_count() {
    68     _count--;
    69     _count--;
    69     assert(_count >= 0, "Count should not be negative"); }
    70     assert(_count >= 0, "Count should not be negative");
       
    71   }
    70 
    72 
    71  public:
    73  public:
    72   // Constructor
    74   // Constructor
    73   // Construct a list without any entries.
    75   // Construct a list without any entries.
    74   FreeList();
    76   FreeList();
   156     return &_allocation_stats;
   158     return &_allocation_stats;
   157   }
   159   }
   158 
   160 
   159   ssize_t desired() const {
   161   ssize_t desired() const {
   160     return _allocation_stats.desired();
   162     return _allocation_stats.desired();
       
   163   }
       
   164   void set_desired(ssize_t v) {
       
   165     assert_proper_lock_protection();
       
   166     _allocation_stats.set_desired(v);
   161   }
   167   }
   162   void compute_desired(float inter_sweep_current,
   168   void compute_desired(float inter_sweep_current,
   163                        float inter_sweep_estimate) {
   169                        float inter_sweep_estimate) {
   164     assert_proper_lock_protection();
   170     assert_proper_lock_protection();
   165     _allocation_stats.compute_desired(_count,
   171     _allocation_stats.compute_desired(_count,
   296   void prepend(FreeList* fl);
   302   void prepend(FreeList* fl);
   297 
   303 
   298   // Verify that the chunk is in the list.
   304   // Verify that the chunk is in the list.
   299   // found.  Return NULL if "fc" is not found.
   305   // found.  Return NULL if "fc" is not found.
   300   bool verifyChunkInFreeLists(FreeChunk* fc) const;
   306   bool verifyChunkInFreeLists(FreeChunk* fc) const;
       
   307 
       
   308   // Printing support
       
   309   static void print_labels_on(outputStream* st, const char* c);
       
   310   void print_on(outputStream* st, const char* c = NULL) const;
   301 };
   311 };