hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeList.hpp
changeset 4574 b2d5b0975515
parent 670 ddf3e9583f2f
child 5547 f4b087cbb361
equal deleted inserted replaced
4481:de92ec484f5e 4574:b2d5b0975515
    33 //
    33 //
    34 // See the corresponding .cpp file for a description of the specifics
    34 // See the corresponding .cpp file for a description of the specifics
    35 // for that implementation.
    35 // for that implementation.
    36 
    36 
    37 class Mutex;
    37 class Mutex;
       
    38 class TreeList;
    38 
    39 
    39 class FreeList VALUE_OBJ_CLASS_SPEC {
    40 class FreeList VALUE_OBJ_CLASS_SPEC {
    40   friend class CompactibleFreeListSpace;
    41   friend class CompactibleFreeListSpace;
    41   friend class VMStructs;
    42   friend class VMStructs;
    42   friend class printTreeCensusClosure;
    43   friend class PrintTreeCensusClosure;
    43   FreeChunk*    _head;          // List of free chunks
    44 
       
    45  protected:
       
    46   TreeList* _parent;
       
    47   TreeList* _left;
       
    48   TreeList* _right;
       
    49 
       
    50  private:
       
    51   FreeChunk*    _head;          // Head of list of free chunks
    44   FreeChunk*    _tail;          // Tail of list of free chunks
    52   FreeChunk*    _tail;          // Tail of list of free chunks
    45   size_t        _size;          // Size in Heap words of each chunks
    53   size_t        _size;          // Size in Heap words of each chunk
    46   ssize_t       _count;         // Number of entries in list
    54   ssize_t       _count;         // Number of entries in list
    47   size_t        _hint;          // next larger size list with a positive surplus
    55   size_t        _hint;          // next larger size list with a positive surplus
    48 
    56 
    49   AllocationStats _allocation_stats;            // statistics for smart allocation
    57   AllocationStats _allocation_stats; // allocation-related statistics
    50 
    58 
    51 #ifdef ASSERT
    59 #ifdef ASSERT
    52   Mutex*        _protecting_lock;
    60   Mutex*        _protecting_lock;
    53 #endif
    61 #endif
    54 
    62 
    61 #endif
    69 #endif
    62   }
    70   }
    63 
    71 
    64   // Initialize the allocation statistics.
    72   // Initialize the allocation statistics.
    65  protected:
    73  protected:
    66   void init_statistics();
    74   void init_statistics(bool split_birth = false);
    67   void set_count(ssize_t v) { _count = v;}
    75   void set_count(ssize_t v) { _count = v;}
    68   void increment_count()    { _count++; }
    76   void increment_count()    {
       
    77     _count++;
       
    78   }
       
    79 
    69   void decrement_count() {
    80   void decrement_count() {
    70     _count--;
    81     _count--;
    71     assert(_count >= 0, "Count should not be negative");
    82     assert(_count >= 0, "Count should not be negative");
    72   }
    83   }
    73 
    84 
   165   void set_desired(ssize_t v) {
   176   void set_desired(ssize_t v) {
   166     assert_proper_lock_protection();
   177     assert_proper_lock_protection();
   167     _allocation_stats.set_desired(v);
   178     _allocation_stats.set_desired(v);
   168   }
   179   }
   169   void compute_desired(float inter_sweep_current,
   180   void compute_desired(float inter_sweep_current,
   170                        float inter_sweep_estimate) {
   181                        float inter_sweep_estimate,
       
   182                        float intra_sweep_estimate) {
   171     assert_proper_lock_protection();
   183     assert_proper_lock_protection();
   172     _allocation_stats.compute_desired(_count,
   184     _allocation_stats.compute_desired(_count,
   173                                       inter_sweep_current,
   185                                       inter_sweep_current,
   174                                       inter_sweep_estimate);
   186                                       inter_sweep_estimate,
       
   187                                       intra_sweep_estimate);
   175   }
   188   }
   176   ssize_t coalDesired() const {
   189   ssize_t coalDesired() const {
   177     return _allocation_stats.coalDesired();
   190     return _allocation_stats.coalDesired();
   178   }
   191   }
   179   void set_coalDesired(ssize_t v) {
   192   void set_coalDesired(ssize_t v) {
   304 
   317 
   305   // Verify that the chunk is in the list.
   318   // Verify that the chunk is in the list.
   306   // found.  Return NULL if "fc" is not found.
   319   // found.  Return NULL if "fc" is not found.
   307   bool verifyChunkInFreeLists(FreeChunk* fc) const;
   320   bool verifyChunkInFreeLists(FreeChunk* fc) const;
   308 
   321 
       
   322   // Stats verification
       
   323   void verify_stats() const PRODUCT_RETURN;
       
   324 
   309   // Printing support
   325   // Printing support
   310   static void print_labels_on(outputStream* st, const char* c);
   326   static void print_labels_on(outputStream* st, const char* c);
   311   void print_on(outputStream* st, const char* c = NULL) const;
   327   void print_on(outputStream* st, const char* c = NULL) const;
   312 };
   328 };