< prev index next >

src/share/vm/gc/cms/adaptiveFreeList.hpp

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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_IMPLEMENTATION_CONCURRENTMARKSWEEP_ADAPTIVEFREELIST_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_ADAPTIVEFREELIST_HPP
  27 

  28 #include "memory/freeList.hpp"
  29 #include "gc_implementation/shared/allocationStats.hpp"
  30 
  31 class CompactibleFreeListSpace;
  32 
  33 // A class for maintaining a free list of Chunk's.  The FreeList
  34 // maintains a the structure of the list (head, tail, etc.) plus
  35 // statistics for allocations from the list.  The links between items
  36 // are not part of FreeList.  The statistics are
  37 // used to make decisions about coalescing Chunk's when they
  38 // are swept during collection.
  39 //
  40 // See the corresponding .cpp file for a description of the specifics
  41 // for that implementation.
  42 
  43 class Mutex;
  44 
  45 template <class Chunk>
  46 class AdaptiveFreeList : public FreeList<Chunk> {
  47   friend class CompactibleFreeListSpace;
  48   friend class VMStructs;
  49   // friend class PrintTreeCensusClosure<Chunk, FreeList_t>;


 209   }
 210   void increment_split_deaths() {
 211     assert_proper_lock_protection();
 212     _allocation_stats.increment_split_deaths();
 213   }
 214 
 215 #ifndef PRODUCT
 216   // For debugging.  The "_returned_bytes" in all the lists are summed
 217   // and compared with the total number of bytes swept during a
 218   // collection.
 219   size_t returned_bytes() const { return _allocation_stats.returned_bytes(); }
 220   void set_returned_bytes(size_t v) { _allocation_stats.set_returned_bytes(v); }
 221   void increment_returned_bytes_by(size_t v) {
 222     _allocation_stats.set_returned_bytes(_allocation_stats.returned_bytes() + v);
 223   }
 224   // Stats verification
 225   void verify_stats() const;
 226 #endif  // NOT PRODUCT
 227 };
 228 
 229 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_ADAPTIVEFREELIST_HPP


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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_CMS_ADAPTIVEFREELIST_HPP
  26 #define SHARE_VM_GC_CMS_ADAPTIVEFREELIST_HPP
  27 
  28 #include "gc/cms/allocationStats.hpp"
  29 #include "memory/freeList.hpp"

  30 
  31 class CompactibleFreeListSpace;
  32 
  33 // A class for maintaining a free list of Chunk's.  The FreeList
  34 // maintains a the structure of the list (head, tail, etc.) plus
  35 // statistics for allocations from the list.  The links between items
  36 // are not part of FreeList.  The statistics are
  37 // used to make decisions about coalescing Chunk's when they
  38 // are swept during collection.
  39 //
  40 // See the corresponding .cpp file for a description of the specifics
  41 // for that implementation.
  42 
  43 class Mutex;
  44 
  45 template <class Chunk>
  46 class AdaptiveFreeList : public FreeList<Chunk> {
  47   friend class CompactibleFreeListSpace;
  48   friend class VMStructs;
  49   // friend class PrintTreeCensusClosure<Chunk, FreeList_t>;


 209   }
 210   void increment_split_deaths() {
 211     assert_proper_lock_protection();
 212     _allocation_stats.increment_split_deaths();
 213   }
 214 
 215 #ifndef PRODUCT
 216   // For debugging.  The "_returned_bytes" in all the lists are summed
 217   // and compared with the total number of bytes swept during a
 218   // collection.
 219   size_t returned_bytes() const { return _allocation_stats.returned_bytes(); }
 220   void set_returned_bytes(size_t v) { _allocation_stats.set_returned_bytes(v); }
 221   void increment_returned_bytes_by(size_t v) {
 222     _allocation_stats.set_returned_bytes(_allocation_stats.returned_bytes() + v);
 223   }
 224   // Stats verification
 225   void verify_stats() const;
 226 #endif  // NOT PRODUCT
 227 };
 228 
 229 #endif // SHARE_VM_GC_CMS_ADAPTIVEFREELIST_HPP
< prev index next >