Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @ 6885:685df3c6f84b
7045397: NPG: Add freelists to class loader arenas.
Reviewed-by: coleenp, stefank, jprovino, ohair
author | jmasa |
---|---|
date | Tue, 18 Sep 2012 23:35:42 -0700 |
parents | da91efe96a93 |
children | 3c327c2b6782 |
comparison
equal
deleted
inserted
replaced
6877:d0e7716b179e | 6885:685df3c6f84b |
---|---|
23 */ | 23 */ |
24 | 24 |
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_COMPACTIBLEFREELISTSPACE_HPP | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_COMPACTIBLEFREELISTSPACE_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_COMPACTIBLEFREELISTSPACE_HPP | 26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_COMPACTIBLEFREELISTSPACE_HPP |
27 | 27 |
28 #include "gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp" | |
28 #include "gc_implementation/concurrentMarkSweep/promotionInfo.hpp" | 29 #include "gc_implementation/concurrentMarkSweep/promotionInfo.hpp" |
29 #include "memory/binaryTreeDictionary.hpp" | 30 #include "memory/binaryTreeDictionary.hpp" |
30 #include "memory/blockOffsetTable.inline.hpp" | 31 #include "memory/blockOffsetTable.inline.hpp" |
31 #include "memory/freeList.hpp" | 32 #include "memory/freeList.hpp" |
32 #include "memory/space.hpp" | 33 #include "memory/space.hpp" |
36 | 37 |
37 // Forward declarations | 38 // Forward declarations |
38 class CompactibleFreeListSpace; | 39 class CompactibleFreeListSpace; |
39 class BlkClosure; | 40 class BlkClosure; |
40 class BlkClosureCareful; | 41 class BlkClosureCareful; |
42 class FreeChunk; | |
41 class UpwardsObjectClosure; | 43 class UpwardsObjectClosure; |
42 class ObjectClosureCareful; | 44 class ObjectClosureCareful; |
43 class Klass; | 45 class Klass; |
44 | 46 |
45 class LinearAllocBlock VALUE_OBJ_CLASS_SPEC { | 47 class LinearAllocBlock VALUE_OBJ_CLASS_SPEC { |
129 LinearAllocBlock _smallLinearAllocBlock; | 131 LinearAllocBlock _smallLinearAllocBlock; |
130 | 132 |
131 FreeBlockDictionary<FreeChunk>::DictionaryChoice _dictionaryChoice; | 133 FreeBlockDictionary<FreeChunk>::DictionaryChoice _dictionaryChoice; |
132 FreeBlockDictionary<FreeChunk>* _dictionary; // ptr to dictionary for large size blocks | 134 FreeBlockDictionary<FreeChunk>* _dictionary; // ptr to dictionary for large size blocks |
133 | 135 |
134 FreeList<FreeChunk> _indexedFreeList[IndexSetSize]; | 136 AdaptiveFreeList<FreeChunk> _indexedFreeList[IndexSetSize]; |
135 // indexed array for small size blocks | 137 // indexed array for small size blocks |
136 // allocation stategy | 138 // allocation stategy |
137 bool _fitStrategy; // Use best fit strategy. | 139 bool _fitStrategy; // Use best fit strategy. |
138 bool _adaptive_freelists; // Use adaptive freelists | 140 bool _adaptive_freelists; // Use adaptive freelists |
139 | 141 |
166 // required to be smaller than "IndexSetSize".) If successful, | 168 // required to be smaller than "IndexSetSize".) If successful, |
167 // adds them to "fl", which is required to be an empty free list. | 169 // adds them to "fl", which is required to be an empty free list. |
168 // If the count of "fl" is negative, it's absolute value indicates a | 170 // If the count of "fl" is negative, it's absolute value indicates a |
169 // number of free chunks that had been previously "borrowed" from global | 171 // number of free chunks that had been previously "borrowed" from global |
170 // list of size "word_sz", and must now be decremented. | 172 // list of size "word_sz", and must now be decremented. |
171 void par_get_chunk_of_blocks(size_t word_sz, size_t n, FreeList<FreeChunk>* fl); | 173 void par_get_chunk_of_blocks(size_t word_sz, size_t n, AdaptiveFreeList<FreeChunk>* fl); |
172 | 174 |
173 // Allocation helper functions | 175 // Allocation helper functions |
174 // Allocate using a strategy that takes from the indexed free lists | 176 // Allocate using a strategy that takes from the indexed free lists |
175 // first. This allocation strategy assumes a companion sweeping | 177 // first. This allocation strategy assumes a companion sweeping |
176 // strategy that attempts to keep the needed number of chunks in each | 178 // strategy that attempts to keep the needed number of chunks in each |
212 // For free list "fl" of chunks of size > numWords, | 214 // For free list "fl" of chunks of size > numWords, |
213 // remove a chunk, split off a chunk of size numWords | 215 // remove a chunk, split off a chunk of size numWords |
214 // and return it. The split off remainder is returned to | 216 // and return it. The split off remainder is returned to |
215 // the free lists. The old name for getFromListGreater | 217 // the free lists. The old name for getFromListGreater |
216 // was lookInListGreater. | 218 // was lookInListGreater. |
217 FreeChunk* getFromListGreater(FreeList<FreeChunk>* fl, size_t numWords); | 219 FreeChunk* getFromListGreater(AdaptiveFreeList<FreeChunk>* fl, size_t numWords); |
218 // Get a chunk in the indexed free list or dictionary, | 220 // Get a chunk in the indexed free list or dictionary, |
219 // by considering a larger chunk and splitting it. | 221 // by considering a larger chunk and splitting it. |
220 FreeChunk* getChunkFromGreater(size_t numWords); | 222 FreeChunk* getChunkFromGreater(size_t numWords); |
221 // Verify that the given chunk is in the indexed free lists. | 223 // Verify that the given chunk is in the indexed free lists. |
222 bool verifyChunkInIndexedFreeLists(FreeChunk* fc) const; | 224 bool verifyChunkInIndexedFreeLists(FreeChunk* fc) const; |
619 class CFLS_LAB : public CHeapObj<mtGC> { | 621 class CFLS_LAB : public CHeapObj<mtGC> { |
620 // The space that this buffer allocates into. | 622 // The space that this buffer allocates into. |
621 CompactibleFreeListSpace* _cfls; | 623 CompactibleFreeListSpace* _cfls; |
622 | 624 |
623 // Our local free lists. | 625 // Our local free lists. |
624 FreeList<FreeChunk> _indexedFreeList[CompactibleFreeListSpace::IndexSetSize]; | 626 AdaptiveFreeList<FreeChunk> _indexedFreeList[CompactibleFreeListSpace::IndexSetSize]; |
625 | 627 |
626 // Initialized from a command-line arg. | 628 // Initialized from a command-line arg. |
627 | 629 |
628 // Allocation statistics in support of dynamic adjustment of | 630 // Allocation statistics in support of dynamic adjustment of |
629 // #blocks to claim per get_from_global_pool() call below. | 631 // #blocks to claim per get_from_global_pool() call below. |
632 static size_t _global_num_blocks [CompactibleFreeListSpace::IndexSetSize]; | 634 static size_t _global_num_blocks [CompactibleFreeListSpace::IndexSetSize]; |
633 static uint _global_num_workers[CompactibleFreeListSpace::IndexSetSize]; | 635 static uint _global_num_workers[CompactibleFreeListSpace::IndexSetSize]; |
634 size_t _num_blocks [CompactibleFreeListSpace::IndexSetSize]; | 636 size_t _num_blocks [CompactibleFreeListSpace::IndexSetSize]; |
635 | 637 |
636 // Internal work method | 638 // Internal work method |
637 void get_from_global_pool(size_t word_sz, FreeList<FreeChunk>* fl); | 639 void get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>* fl); |
638 | 640 |
639 public: | 641 public: |
640 CFLS_LAB(CompactibleFreeListSpace* cfls); | 642 CFLS_LAB(CompactibleFreeListSpace* cfls); |
641 | 643 |
642 // Allocate and return a block of the given size, or else return NULL. | 644 // Allocate and return a block of the given size, or else return NULL. |