Tue, 11 Feb 2014 09:34:50 +0100
8034171: Remove use of template template parameters from binaryTreeDictionary.
Reviewed-by: mgerdin, jmasa
Contributed-by: matthias.baesken@sap.com
1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Wed Feb 26 22:11:26 2014 +0100 1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Tue Feb 11 09:34:50 2014 +0100 1.3 @@ -1704,8 +1704,8 @@ 1.4 _dictionary->return_chunk(chunk); 1.5 #ifndef PRODUCT 1.6 if (CMSCollector::abstract_state() != CMSCollector::Sweeping) { 1.7 - TreeChunk<FreeChunk, AdaptiveFreeList>* tc = TreeChunk<FreeChunk, AdaptiveFreeList>::as_TreeChunk(chunk); 1.8 - TreeList<FreeChunk, AdaptiveFreeList>* tl = tc->list(); 1.9 + TreeChunk<FreeChunk, AdaptiveFreeList<FreeChunk> >* tc = TreeChunk<FreeChunk, AdaptiveFreeList<FreeChunk> >::as_TreeChunk(chunk); 1.10 + TreeList<FreeChunk, AdaptiveFreeList<FreeChunk> >* tl = tc->list(); 1.11 tl->verify_stats(); 1.12 } 1.13 #endif // PRODUCT 1.14 @@ -2515,10 +2515,10 @@ 1.15 1.16 #ifndef PRODUCT 1.17 void CompactibleFreeListSpace::check_free_list_consistency() const { 1.18 - assert((TreeChunk<FreeChunk, AdaptiveFreeList>::min_size() <= IndexSetSize), 1.19 + assert((TreeChunk<FreeChunk, AdaptiveFreeList<FreeChunk> >::min_size() <= IndexSetSize), 1.20 "Some sizes can't be allocated without recourse to" 1.21 " linear allocation buffers"); 1.22 - assert((TreeChunk<FreeChunk, AdaptiveFreeList>::min_size()*HeapWordSize == sizeof(TreeChunk<FreeChunk, AdaptiveFreeList>)), 1.23 + assert((TreeChunk<FreeChunk, AdaptiveFreeList<FreeChunk> >::min_size()*HeapWordSize == sizeof(TreeChunk<FreeChunk, AdaptiveFreeList<FreeChunk> >)), 1.24 "else MIN_TREE_CHUNK_SIZE is wrong"); 1.25 assert(IndexSetStart != 0, "IndexSetStart not initialized"); 1.26 assert(IndexSetStride != 0, "IndexSetStride not initialized");
2.1 --- a/src/share/vm/memory/binaryTreeDictionary.cpp Wed Feb 26 22:11:26 2014 +0100 2.2 +++ b/src/share/vm/memory/binaryTreeDictionary.cpp Tue Feb 11 09:34:50 2014 +0100 2.3 @@ -44,16 +44,16 @@ 2.4 // This is currently used in the Concurrent Mark&Sweep implementation. 2.5 //////////////////////////////////////////////////////////////////////////////// 2.6 2.7 -template <class Chunk_t, template <class> class FreeList_t> 2.8 +template <class Chunk_t, class FreeList_t> 2.9 size_t TreeChunk<Chunk_t, FreeList_t>::_min_tree_chunk_size = sizeof(TreeChunk<Chunk_t, FreeList_t>)/HeapWordSize; 2.10 2.11 -template <class Chunk_t, template <class> class FreeList_t> 2.12 +template <class Chunk_t, class FreeList_t> 2.13 TreeChunk<Chunk_t, FreeList_t>* TreeChunk<Chunk_t, FreeList_t>::as_TreeChunk(Chunk_t* fc) { 2.14 // Do some assertion checking here. 2.15 return (TreeChunk<Chunk_t, FreeList_t>*) fc; 2.16 } 2.17 2.18 -template <class Chunk_t, template <class> class FreeList_t> 2.19 +template <class Chunk_t, class FreeList_t> 2.20 void TreeChunk<Chunk_t, FreeList_t>::verify_tree_chunk_list() const { 2.21 TreeChunk<Chunk_t, FreeList_t>* nextTC = (TreeChunk<Chunk_t, FreeList_t>*)next(); 2.22 if (prev() != NULL) { // interior list node shouldn'r have tree fields 2.23 @@ -67,11 +67,11 @@ 2.24 } 2.25 } 2.26 2.27 -template <class Chunk_t, template <class> class FreeList_t> 2.28 +template <class Chunk_t, class FreeList_t> 2.29 TreeList<Chunk_t, FreeList_t>::TreeList() : _parent(NULL), 2.30 _left(NULL), _right(NULL) {} 2.31 2.32 -template <class Chunk_t, template <class> class FreeList_t> 2.33 +template <class Chunk_t, class FreeList_t> 2.34 TreeList<Chunk_t, FreeList_t>* 2.35 TreeList<Chunk_t, FreeList_t>::as_TreeList(TreeChunk<Chunk_t,FreeList_t>* tc) { 2.36 // This first free chunk in the list will be the tree list. 2.37 @@ -88,20 +88,7 @@ 2.38 return tl; 2.39 } 2.40 2.41 - 2.42 -template <class Chunk_t, template <class> class FreeList_t> 2.43 -TreeList<Chunk_t, FreeList_t>* 2.44 -get_chunk(size_t size, enum FreeBlockDictionary<Chunk_t>::Dither dither) { 2.45 - FreeBlockDictionary<Chunk_t>::verify_par_locked(); 2.46 - Chunk_t* res = get_chunk_from_tree(size, dither); 2.47 - assert(res == NULL || res->is_free(), 2.48 - "Should be returning a free chunk"); 2.49 - assert(dither != FreeBlockDictionary<Chunk_t>::exactly || 2.50 - res->size() == size, "Not correct size"); 2.51 - return res; 2.52 -} 2.53 - 2.54 -template <class Chunk_t, template <class> class FreeList_t> 2.55 +template <class Chunk_t, class FreeList_t> 2.56 TreeList<Chunk_t, FreeList_t>* 2.57 TreeList<Chunk_t, FreeList_t>::as_TreeList(HeapWord* addr, size_t size) { 2.58 TreeChunk<Chunk_t, FreeList_t>* tc = (TreeChunk<Chunk_t, FreeList_t>*) addr; 2.59 @@ -125,17 +112,17 @@ 2.60 // an over populated size. The general get_better_list() just returns 2.61 // the current list. 2.62 template <> 2.63 -TreeList<FreeChunk, AdaptiveFreeList>* 2.64 -TreeList<FreeChunk, AdaptiveFreeList>::get_better_list( 2.65 - BinaryTreeDictionary<FreeChunk, ::AdaptiveFreeList>* dictionary) { 2.66 +TreeList<FreeChunk, AdaptiveFreeList<FreeChunk> >* 2.67 +TreeList<FreeChunk, AdaptiveFreeList<FreeChunk> >::get_better_list( 2.68 + BinaryTreeDictionary<FreeChunk, ::AdaptiveFreeList<FreeChunk> >* dictionary) { 2.69 // A candidate chunk has been found. If it is already under 2.70 // populated, get a chunk associated with the hint for this 2.71 // chunk. 2.72 2.73 - TreeList<FreeChunk, ::AdaptiveFreeList>* curTL = this; 2.74 + TreeList<FreeChunk, ::AdaptiveFreeList<FreeChunk> >* curTL = this; 2.75 if (surplus() <= 0) { 2.76 /* Use the hint to find a size with a surplus, and reset the hint. */ 2.77 - TreeList<FreeChunk, ::AdaptiveFreeList>* hintTL = this; 2.78 + TreeList<FreeChunk, ::AdaptiveFreeList<FreeChunk> >* hintTL = this; 2.79 while (hintTL->hint() != 0) { 2.80 assert(hintTL->hint() > hintTL->size(), 2.81 "hint points in the wrong direction"); 2.82 @@ -163,14 +150,14 @@ 2.83 } 2.84 #endif // INCLUDE_ALL_GCS 2.85 2.86 -template <class Chunk_t, template <class> class FreeList_t> 2.87 +template <class Chunk_t, class FreeList_t> 2.88 TreeList<Chunk_t, FreeList_t>* 2.89 TreeList<Chunk_t, FreeList_t>::get_better_list( 2.90 BinaryTreeDictionary<Chunk_t, FreeList_t>* dictionary) { 2.91 return this; 2.92 } 2.93 2.94 -template <class Chunk_t, template <class> class FreeList_t> 2.95 +template <class Chunk_t, class FreeList_t> 2.96 TreeList<Chunk_t, FreeList_t>* TreeList<Chunk_t, FreeList_t>::remove_chunk_replace_if_needed(TreeChunk<Chunk_t, FreeList_t>* tc) { 2.97 2.98 TreeList<Chunk_t, FreeList_t>* retTL = this; 2.99 @@ -286,7 +273,7 @@ 2.100 return retTL; 2.101 } 2.102 2.103 -template <class Chunk_t, template <class> class FreeList_t> 2.104 +template <class Chunk_t, class FreeList_t> 2.105 void TreeList<Chunk_t, FreeList_t>::return_chunk_at_tail(TreeChunk<Chunk_t, FreeList_t>* chunk) { 2.106 assert(chunk != NULL, "returning NULL chunk"); 2.107 assert(chunk->list() == this, "list should be set for chunk"); 2.108 @@ -301,7 +288,7 @@ 2.109 this->link_tail(chunk); 2.110 2.111 assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list"); 2.112 - FreeList_t<Chunk_t>::increment_count(); 2.113 + FreeList_t::increment_count(); 2.114 debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));) 2.115 assert(head() == NULL || head()->prev() == NULL, "list invariant"); 2.116 assert(tail() == NULL || tail()->next() == NULL, "list invariant"); 2.117 @@ -311,7 +298,7 @@ 2.118 // is defined to be after the chunk pointer to by head(). This is 2.119 // because the TreeList<Chunk_t, FreeList_t> is embedded in the first TreeChunk<Chunk_t, FreeList_t> in the 2.120 // list. See the definition of TreeChunk<Chunk_t, FreeList_t>. 2.121 -template <class Chunk_t, template <class> class FreeList_t> 2.122 +template <class Chunk_t, class FreeList_t> 2.123 void TreeList<Chunk_t, FreeList_t>::return_chunk_at_head(TreeChunk<Chunk_t, FreeList_t>* chunk) { 2.124 assert(chunk->list() == this, "list should be set for chunk"); 2.125 assert(head() != NULL, "The tree list is embedded in the first chunk"); 2.126 @@ -329,13 +316,13 @@ 2.127 } 2.128 head()->link_after(chunk); 2.129 assert(!head() || size() == head()->size(), "Wrong sized chunk in list"); 2.130 - FreeList_t<Chunk_t>::increment_count(); 2.131 + FreeList_t::increment_count(); 2.132 debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));) 2.133 assert(head() == NULL || head()->prev() == NULL, "list invariant"); 2.134 assert(tail() == NULL || tail()->next() == NULL, "list invariant"); 2.135 } 2.136 2.137 -template <class Chunk_t, template <class> class FreeList_t> 2.138 +template <class Chunk_t, class FreeList_t> 2.139 void TreeChunk<Chunk_t, FreeList_t>::assert_is_mangled() const { 2.140 assert((ZapUnusedHeapArea && 2.141 SpaceMangler::is_mangled((HeapWord*) Chunk_t::size_addr()) && 2.142 @@ -345,14 +332,14 @@ 2.143 "Space should be clear or mangled"); 2.144 } 2.145 2.146 -template <class Chunk_t, template <class> class FreeList_t> 2.147 +template <class Chunk_t, class FreeList_t> 2.148 TreeChunk<Chunk_t, FreeList_t>* TreeList<Chunk_t, FreeList_t>::head_as_TreeChunk() { 2.149 assert(head() == NULL || (TreeChunk<Chunk_t, FreeList_t>::as_TreeChunk(head())->list() == this), 2.150 "Wrong type of chunk?"); 2.151 return TreeChunk<Chunk_t, FreeList_t>::as_TreeChunk(head()); 2.152 } 2.153 2.154 -template <class Chunk_t, template <class> class FreeList_t> 2.155 +template <class Chunk_t, class FreeList_t> 2.156 TreeChunk<Chunk_t, FreeList_t>* TreeList<Chunk_t, FreeList_t>::first_available() { 2.157 assert(head() != NULL, "The head of the list cannot be NULL"); 2.158 Chunk_t* fc = head()->next(); 2.159 @@ -369,7 +356,7 @@ 2.160 // Returns the block with the largest heap address amongst 2.161 // those in the list for this size; potentially slow and expensive, 2.162 // use with caution! 2.163 -template <class Chunk_t, template <class> class FreeList_t> 2.164 +template <class Chunk_t, class FreeList_t> 2.165 TreeChunk<Chunk_t, FreeList_t>* TreeList<Chunk_t, FreeList_t>::largest_address() { 2.166 assert(head() != NULL, "The head of the list cannot be NULL"); 2.167 Chunk_t* fc = head()->next(); 2.168 @@ -392,7 +379,7 @@ 2.169 return retTC; 2.170 } 2.171 2.172 -template <class Chunk_t, template <class> class FreeList_t> 2.173 +template <class Chunk_t, class FreeList_t> 2.174 BinaryTreeDictionary<Chunk_t, FreeList_t>::BinaryTreeDictionary(MemRegion mr) { 2.175 assert((mr.byte_size() > min_size()), "minimum chunk size"); 2.176 2.177 @@ -405,17 +392,17 @@ 2.178 assert(total_free_blocks() == 1, "reset check failed"); 2.179 } 2.180 2.181 -template <class Chunk_t, template <class> class FreeList_t> 2.182 +template <class Chunk_t, class FreeList_t> 2.183 void BinaryTreeDictionary<Chunk_t, FreeList_t>::inc_total_size(size_t inc) { 2.184 _total_size = _total_size + inc; 2.185 } 2.186 2.187 -template <class Chunk_t, template <class> class FreeList_t> 2.188 +template <class Chunk_t, class FreeList_t> 2.189 void BinaryTreeDictionary<Chunk_t, FreeList_t>::dec_total_size(size_t dec) { 2.190 _total_size = _total_size - dec; 2.191 } 2.192 2.193 -template <class Chunk_t, template <class> class FreeList_t> 2.194 +template <class Chunk_t, class FreeList_t> 2.195 void BinaryTreeDictionary<Chunk_t, FreeList_t>::reset(MemRegion mr) { 2.196 assert((mr.byte_size() > min_size()), "minimum chunk size"); 2.197 set_root(TreeList<Chunk_t, FreeList_t>::as_TreeList(mr.start(), mr.word_size())); 2.198 @@ -423,13 +410,13 @@ 2.199 set_total_free_blocks(1); 2.200 } 2.201 2.202 -template <class Chunk_t, template <class> class FreeList_t> 2.203 +template <class Chunk_t, class FreeList_t> 2.204 void BinaryTreeDictionary<Chunk_t, FreeList_t>::reset(HeapWord* addr, size_t byte_size) { 2.205 MemRegion mr(addr, heap_word_size(byte_size)); 2.206 reset(mr); 2.207 } 2.208 2.209 -template <class Chunk_t, template <class> class FreeList_t> 2.210 +template <class Chunk_t, class FreeList_t> 2.211 void BinaryTreeDictionary<Chunk_t, FreeList_t>::reset() { 2.212 set_root(NULL); 2.213 set_total_size(0); 2.214 @@ -437,7 +424,7 @@ 2.215 } 2.216 2.217 // Get a free block of size at least size from tree, or NULL. 2.218 -template <class Chunk_t, template <class> class FreeList_t> 2.219 +template <class Chunk_t, class FreeList_t> 2.220 TreeChunk<Chunk_t, FreeList_t>* 2.221 BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree( 2.222 size_t size, 2.223 @@ -496,7 +483,7 @@ 2.224 return retTC; 2.225 } 2.226 2.227 -template <class Chunk_t, template <class> class FreeList_t> 2.228 +template <class Chunk_t, class FreeList_t> 2.229 TreeList<Chunk_t, FreeList_t>* BinaryTreeDictionary<Chunk_t, FreeList_t>::find_list(size_t size) const { 2.230 TreeList<Chunk_t, FreeList_t>* curTL; 2.231 for (curTL = root(); curTL != NULL;) { 2.232 @@ -515,7 +502,7 @@ 2.233 } 2.234 2.235 2.236 -template <class Chunk_t, template <class> class FreeList_t> 2.237 +template <class Chunk_t, class FreeList_t> 2.238 bool BinaryTreeDictionary<Chunk_t, FreeList_t>::verify_chunk_in_free_list(Chunk_t* tc) const { 2.239 size_t size = tc->size(); 2.240 TreeList<Chunk_t, FreeList_t>* tl = find_list(size); 2.241 @@ -526,7 +513,7 @@ 2.242 } 2.243 } 2.244 2.245 -template <class Chunk_t, template <class> class FreeList_t> 2.246 +template <class Chunk_t, class FreeList_t> 2.247 Chunk_t* BinaryTreeDictionary<Chunk_t, FreeList_t>::find_largest_dict() const { 2.248 TreeList<Chunk_t, FreeList_t> *curTL = root(); 2.249 if (curTL != NULL) { 2.250 @@ -541,7 +528,7 @@ 2.251 // chunk in a list on a tree node, just unlink it. 2.252 // If it is the last chunk in the list (the next link is NULL), 2.253 // remove the node and repair the tree. 2.254 -template <class Chunk_t, template <class> class FreeList_t> 2.255 +template <class Chunk_t, class FreeList_t> 2.256 TreeChunk<Chunk_t, FreeList_t>* 2.257 BinaryTreeDictionary<Chunk_t, FreeList_t>::remove_chunk_from_tree(TreeChunk<Chunk_t, FreeList_t>* tc) { 2.258 assert(tc != NULL, "Should not call with a NULL chunk"); 2.259 @@ -682,7 +669,7 @@ 2.260 // Remove the leftmost node (lm) in the tree and return it. 2.261 // If lm has a right child, link it to the left node of 2.262 // the parent of lm. 2.263 -template <class Chunk_t, template <class> class FreeList_t> 2.264 +template <class Chunk_t, class FreeList_t> 2.265 TreeList<Chunk_t, FreeList_t>* BinaryTreeDictionary<Chunk_t, FreeList_t>::remove_tree_minimum(TreeList<Chunk_t, FreeList_t>* tl) { 2.266 assert(tl != NULL && tl->parent() != NULL, "really need a proper sub-tree"); 2.267 // locate the subtree minimum by walking down left branches 2.268 @@ -717,7 +704,7 @@ 2.269 return curTL; 2.270 } 2.271 2.272 -template <class Chunk_t, template <class> class FreeList_t> 2.273 +template <class Chunk_t, class FreeList_t> 2.274 void BinaryTreeDictionary<Chunk_t, FreeList_t>::insert_chunk_in_tree(Chunk_t* fc) { 2.275 TreeList<Chunk_t, FreeList_t> *curTL, *prevTL; 2.276 size_t size = fc->size(); 2.277 @@ -783,7 +770,7 @@ 2.278 } 2.279 } 2.280 2.281 -template <class Chunk_t, template <class> class FreeList_t> 2.282 +template <class Chunk_t, class FreeList_t> 2.283 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::max_chunk_size() const { 2.284 FreeBlockDictionary<Chunk_t>::verify_par_locked(); 2.285 TreeList<Chunk_t, FreeList_t>* tc = root(); 2.286 @@ -792,7 +779,7 @@ 2.287 return tc->size(); 2.288 } 2.289 2.290 -template <class Chunk_t, template <class> class FreeList_t> 2.291 +template <class Chunk_t, class FreeList_t> 2.292 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_list_length(TreeList<Chunk_t, FreeList_t>* tl) const { 2.293 size_t res; 2.294 res = tl->count(); 2.295 @@ -805,7 +792,7 @@ 2.296 return res; 2.297 } 2.298 2.299 -template <class Chunk_t, template <class> class FreeList_t> 2.300 +template <class Chunk_t, class FreeList_t> 2.301 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_size_in_tree(TreeList<Chunk_t, FreeList_t>* tl) const { 2.302 if (tl == NULL) 2.303 return 0; 2.304 @@ -814,7 +801,7 @@ 2.305 total_size_in_tree(tl->right()); 2.306 } 2.307 2.308 -template <class Chunk_t, template <class> class FreeList_t> 2.309 +template <class Chunk_t, class FreeList_t> 2.310 double BinaryTreeDictionary<Chunk_t, FreeList_t>::sum_of_squared_block_sizes(TreeList<Chunk_t, FreeList_t>* const tl) const { 2.311 if (tl == NULL) { 2.312 return 0.0; 2.313 @@ -826,7 +813,7 @@ 2.314 return curr; 2.315 } 2.316 2.317 -template <class Chunk_t, template <class> class FreeList_t> 2.318 +template <class Chunk_t, class FreeList_t> 2.319 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_free_blocks_in_tree(TreeList<Chunk_t, FreeList_t>* tl) const { 2.320 if (tl == NULL) 2.321 return 0; 2.322 @@ -835,14 +822,14 @@ 2.323 total_free_blocks_in_tree(tl->right()); 2.324 } 2.325 2.326 -template <class Chunk_t, template <class> class FreeList_t> 2.327 +template <class Chunk_t, class FreeList_t> 2.328 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::num_free_blocks() const { 2.329 assert(total_free_blocks_in_tree(root()) == total_free_blocks(), 2.330 "_total_free_blocks inconsistency"); 2.331 return total_free_blocks(); 2.332 } 2.333 2.334 -template <class Chunk_t, template <class> class FreeList_t> 2.335 +template <class Chunk_t, class FreeList_t> 2.336 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::tree_height_helper(TreeList<Chunk_t, FreeList_t>* tl) const { 2.337 if (tl == NULL) 2.338 return 0; 2.339 @@ -850,12 +837,12 @@ 2.340 tree_height_helper(tl->right())); 2.341 } 2.342 2.343 -template <class Chunk_t, template <class> class FreeList_t> 2.344 +template <class Chunk_t, class FreeList_t> 2.345 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::tree_height() const { 2.346 return tree_height_helper(root()); 2.347 } 2.348 2.349 -template <class Chunk_t, template <class> class FreeList_t> 2.350 +template <class Chunk_t, class FreeList_t> 2.351 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_nodes_helper(TreeList<Chunk_t, FreeList_t>* tl) const { 2.352 if (tl == NULL) { 2.353 return 0; 2.354 @@ -864,18 +851,18 @@ 2.355 total_nodes_helper(tl->right()); 2.356 } 2.357 2.358 -template <class Chunk_t, template <class> class FreeList_t> 2.359 +template <class Chunk_t, class FreeList_t> 2.360 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_nodes_in_tree(TreeList<Chunk_t, FreeList_t>* tl) const { 2.361 return total_nodes_helper(root()); 2.362 } 2.363 2.364 -template <class Chunk_t, template <class> class FreeList_t> 2.365 +template <class Chunk_t, class FreeList_t> 2.366 void BinaryTreeDictionary<Chunk_t, FreeList_t>::dict_census_update(size_t size, bool split, bool birth){} 2.367 2.368 #if INCLUDE_ALL_GCS 2.369 template <> 2.370 -void AFLBinaryTreeDictionary::dict_census_update(size_t size, bool split, bool birth){ 2.371 - TreeList<FreeChunk, AdaptiveFreeList>* nd = find_list(size); 2.372 +void AFLBinaryTreeDictionary::dict_census_update(size_t size, bool split, bool birth) { 2.373 + TreeList<FreeChunk, AdaptiveFreeList<FreeChunk> >* nd = find_list(size); 2.374 if (nd) { 2.375 if (split) { 2.376 if (birth) { 2.377 @@ -903,7 +890,7 @@ 2.378 } 2.379 #endif // INCLUDE_ALL_GCS 2.380 2.381 -template <class Chunk_t, template <class> class FreeList_t> 2.382 +template <class Chunk_t, class FreeList_t> 2.383 bool BinaryTreeDictionary<Chunk_t, FreeList_t>::coal_dict_over_populated(size_t size) { 2.384 // For the general type of freelists, encourage coalescing by 2.385 // returning true. 2.386 @@ -915,7 +902,7 @@ 2.387 bool AFLBinaryTreeDictionary::coal_dict_over_populated(size_t size) { 2.388 if (FLSAlwaysCoalesceLarge) return true; 2.389 2.390 - TreeList<FreeChunk, AdaptiveFreeList>* list_of_size = find_list(size); 2.391 + TreeList<FreeChunk, AdaptiveFreeList<FreeChunk> >* list_of_size = find_list(size); 2.392 // None of requested size implies overpopulated. 2.393 return list_of_size == NULL || list_of_size->coal_desired() <= 0 || 2.394 list_of_size->count() > list_of_size->coal_desired(); 2.395 @@ -928,15 +915,15 @@ 2.396 // do_tree() walks the nodes in the binary tree applying do_list() 2.397 // to each list at each node. 2.398 2.399 -template <class Chunk_t, template <class> class FreeList_t> 2.400 +template <class Chunk_t, class FreeList_t> 2.401 class TreeCensusClosure : public StackObj { 2.402 protected: 2.403 - virtual void do_list(FreeList_t<Chunk_t>* fl) = 0; 2.404 + virtual void do_list(FreeList_t* fl) = 0; 2.405 public: 2.406 virtual void do_tree(TreeList<Chunk_t, FreeList_t>* tl) = 0; 2.407 }; 2.408 2.409 -template <class Chunk_t, template <class> class FreeList_t> 2.410 +template <class Chunk_t, class FreeList_t> 2.411 class AscendTreeCensusClosure : public TreeCensusClosure<Chunk_t, FreeList_t> { 2.412 public: 2.413 void do_tree(TreeList<Chunk_t, FreeList_t>* tl) { 2.414 @@ -948,7 +935,7 @@ 2.415 } 2.416 }; 2.417 2.418 -template <class Chunk_t, template <class> class FreeList_t> 2.419 +template <class Chunk_t, class FreeList_t> 2.420 class DescendTreeCensusClosure : public TreeCensusClosure<Chunk_t, FreeList_t> { 2.421 public: 2.422 void do_tree(TreeList<Chunk_t, FreeList_t>* tl) { 2.423 @@ -962,7 +949,7 @@ 2.424 2.425 // For each list in the tree, calculate the desired, desired 2.426 // coalesce, count before sweep, and surplus before sweep. 2.427 -template <class Chunk_t, template <class> class FreeList_t> 2.428 +template <class Chunk_t, class FreeList_t> 2.429 class BeginSweepClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.430 double _percentage; 2.431 float _inter_sweep_current; 2.432 @@ -995,16 +982,16 @@ 2.433 // Similar to TreeCensusClosure but searches the 2.434 // tree and returns promptly when found. 2.435 2.436 -template <class Chunk_t, template <class> class FreeList_t> 2.437 +template <class Chunk_t, class FreeList_t> 2.438 class TreeSearchClosure : public StackObj { 2.439 protected: 2.440 - virtual bool do_list(FreeList_t<Chunk_t>* fl) = 0; 2.441 + virtual bool do_list(FreeList_t* fl) = 0; 2.442 public: 2.443 virtual bool do_tree(TreeList<Chunk_t, FreeList_t>* tl) = 0; 2.444 }; 2.445 2.446 #if 0 // Don't need this yet but here for symmetry. 2.447 -template <class Chunk_t, template <class> class FreeList_t> 2.448 +template <class Chunk_t, class FreeList_t> 2.449 class AscendTreeSearchClosure : public TreeSearchClosure<Chunk_t> { 2.450 public: 2.451 bool do_tree(TreeList<Chunk_t, FreeList_t>* tl) { 2.452 @@ -1018,7 +1005,7 @@ 2.453 }; 2.454 #endif 2.455 2.456 -template <class Chunk_t, template <class> class FreeList_t> 2.457 +template <class Chunk_t, class FreeList_t> 2.458 class DescendTreeSearchClosure : public TreeSearchClosure<Chunk_t, FreeList_t> { 2.459 public: 2.460 bool do_tree(TreeList<Chunk_t, FreeList_t>* tl) { 2.461 @@ -1033,14 +1020,14 @@ 2.462 2.463 // Searches the tree for a chunk that ends at the 2.464 // specified address. 2.465 -template <class Chunk_t, template <class> class FreeList_t> 2.466 +template <class Chunk_t, class FreeList_t> 2.467 class EndTreeSearchClosure : public DescendTreeSearchClosure<Chunk_t, FreeList_t> { 2.468 HeapWord* _target; 2.469 Chunk_t* _found; 2.470 2.471 public: 2.472 EndTreeSearchClosure(HeapWord* target) : _target(target), _found(NULL) {} 2.473 - bool do_list(FreeList_t<Chunk_t>* fl) { 2.474 + bool do_list(FreeList_t* fl) { 2.475 Chunk_t* item = fl->head(); 2.476 while (item != NULL) { 2.477 if (item->end() == (uintptr_t*) _target) { 2.478 @@ -1054,7 +1041,7 @@ 2.479 Chunk_t* found() { return _found; } 2.480 }; 2.481 2.482 -template <class Chunk_t, template <class> class FreeList_t> 2.483 +template <class Chunk_t, class FreeList_t> 2.484 Chunk_t* BinaryTreeDictionary<Chunk_t, FreeList_t>::find_chunk_ends_at(HeapWord* target) const { 2.485 EndTreeSearchClosure<Chunk_t, FreeList_t> etsc(target); 2.486 bool found_target = etsc.do_tree(root()); 2.487 @@ -1063,7 +1050,7 @@ 2.488 return etsc.found(); 2.489 } 2.490 2.491 -template <class Chunk_t, template <class> class FreeList_t> 2.492 +template <class Chunk_t, class FreeList_t> 2.493 void BinaryTreeDictionary<Chunk_t, FreeList_t>::begin_sweep_dict_census(double coalSurplusPercent, 2.494 float inter_sweep_current, float inter_sweep_estimate, float intra_sweep_estimate) { 2.495 BeginSweepClosure<Chunk_t, FreeList_t> bsc(coalSurplusPercent, inter_sweep_current, 2.496 @@ -1075,32 +1062,32 @@ 2.497 // Closures and methods for calculating total bytes returned to the 2.498 // free lists in the tree. 2.499 #ifndef PRODUCT 2.500 -template <class Chunk_t, template <class> class FreeList_t> 2.501 +template <class Chunk_t, class FreeList_t> 2.502 class InitializeDictReturnedBytesClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.503 public: 2.504 - void do_list(FreeList_t<Chunk_t>* fl) { 2.505 + void do_list(FreeList_t* fl) { 2.506 fl->set_returned_bytes(0); 2.507 } 2.508 }; 2.509 2.510 -template <class Chunk_t, template <class> class FreeList_t> 2.511 +template <class Chunk_t, class FreeList_t> 2.512 void BinaryTreeDictionary<Chunk_t, FreeList_t>::initialize_dict_returned_bytes() { 2.513 InitializeDictReturnedBytesClosure<Chunk_t, FreeList_t> idrb; 2.514 idrb.do_tree(root()); 2.515 } 2.516 2.517 -template <class Chunk_t, template <class> class FreeList_t> 2.518 +template <class Chunk_t, class FreeList_t> 2.519 class ReturnedBytesClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.520 size_t _dict_returned_bytes; 2.521 public: 2.522 ReturnedBytesClosure() { _dict_returned_bytes = 0; } 2.523 - void do_list(FreeList_t<Chunk_t>* fl) { 2.524 + void do_list(FreeList_t* fl) { 2.525 _dict_returned_bytes += fl->returned_bytes(); 2.526 } 2.527 size_t dict_returned_bytes() { return _dict_returned_bytes; } 2.528 }; 2.529 2.530 -template <class Chunk_t, template <class> class FreeList_t> 2.531 +template <class Chunk_t, class FreeList_t> 2.532 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::sum_dict_returned_bytes() { 2.533 ReturnedBytesClosure<Chunk_t, FreeList_t> rbc; 2.534 rbc.do_tree(root()); 2.535 @@ -1109,17 +1096,17 @@ 2.536 } 2.537 2.538 // Count the number of entries in the tree. 2.539 -template <class Chunk_t, template <class> class FreeList_t> 2.540 +template <class Chunk_t, class FreeList_t> 2.541 class treeCountClosure : public DescendTreeCensusClosure<Chunk_t, FreeList_t> { 2.542 public: 2.543 uint count; 2.544 treeCountClosure(uint c) { count = c; } 2.545 - void do_list(FreeList_t<Chunk_t>* fl) { 2.546 + void do_list(FreeList_t* fl) { 2.547 count++; 2.548 } 2.549 }; 2.550 2.551 -template <class Chunk_t, template <class> class FreeList_t> 2.552 +template <class Chunk_t, class FreeList_t> 2.553 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::total_count() { 2.554 treeCountClosure<Chunk_t, FreeList_t> ctc(0); 2.555 ctc.do_tree(root()); 2.556 @@ -1128,7 +1115,7 @@ 2.557 #endif // PRODUCT 2.558 2.559 // Calculate surpluses for the lists in the tree. 2.560 -template <class Chunk_t, template <class> class FreeList_t> 2.561 +template <class Chunk_t, class FreeList_t> 2.562 class setTreeSurplusClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.563 double percentage; 2.564 public: 2.565 @@ -1144,14 +1131,14 @@ 2.566 #endif // INCLUDE_ALL_GCS 2.567 }; 2.568 2.569 -template <class Chunk_t, template <class> class FreeList_t> 2.570 +template <class Chunk_t, class FreeList_t> 2.571 void BinaryTreeDictionary<Chunk_t, FreeList_t>::set_tree_surplus(double splitSurplusPercent) { 2.572 setTreeSurplusClosure<Chunk_t, FreeList_t> sts(splitSurplusPercent); 2.573 sts.do_tree(root()); 2.574 } 2.575 2.576 // Set hints for the lists in the tree. 2.577 -template <class Chunk_t, template <class> class FreeList_t> 2.578 +template <class Chunk_t, class FreeList_t> 2.579 class setTreeHintsClosure : public DescendTreeCensusClosure<Chunk_t, FreeList_t> { 2.580 size_t hint; 2.581 public: 2.582 @@ -1170,14 +1157,14 @@ 2.583 #endif // INCLUDE_ALL_GCS 2.584 }; 2.585 2.586 -template <class Chunk_t, template <class> class FreeList_t> 2.587 +template <class Chunk_t, class FreeList_t> 2.588 void BinaryTreeDictionary<Chunk_t, FreeList_t>::set_tree_hints(void) { 2.589 setTreeHintsClosure<Chunk_t, FreeList_t> sth(0); 2.590 sth.do_tree(root()); 2.591 } 2.592 2.593 // Save count before previous sweep and splits and coalesces. 2.594 -template <class Chunk_t, template <class> class FreeList_t> 2.595 +template <class Chunk_t, class FreeList_t> 2.596 class clearTreeCensusClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.597 void do_list(FreeList<Chunk_t>* fl) {} 2.598 2.599 @@ -1192,14 +1179,14 @@ 2.600 #endif // INCLUDE_ALL_GCS 2.601 }; 2.602 2.603 -template <class Chunk_t, template <class> class FreeList_t> 2.604 +template <class Chunk_t, class FreeList_t> 2.605 void BinaryTreeDictionary<Chunk_t, FreeList_t>::clear_tree_census(void) { 2.606 clearTreeCensusClosure<Chunk_t, FreeList_t> ctc; 2.607 ctc.do_tree(root()); 2.608 } 2.609 2.610 // Do reporting and post sweep clean up. 2.611 -template <class Chunk_t, template <class> class FreeList_t> 2.612 +template <class Chunk_t, class FreeList_t> 2.613 void BinaryTreeDictionary<Chunk_t, FreeList_t>::end_sweep_dict_census(double splitSurplusPercent) { 2.614 // Does walking the tree 3 times hurt? 2.615 set_tree_surplus(splitSurplusPercent); 2.616 @@ -1211,7 +1198,7 @@ 2.617 } 2.618 2.619 // Print summary statistics 2.620 -template <class Chunk_t, template <class> class FreeList_t> 2.621 +template <class Chunk_t, class FreeList_t> 2.622 void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics() const { 2.623 FreeBlockDictionary<Chunk_t>::verify_par_locked(); 2.624 gclog_or_tty->print("Statistics for BinaryTreeDictionary:\n" 2.625 @@ -1230,22 +1217,22 @@ 2.626 // Print census information - counts, births, deaths, etc. 2.627 // for each list in the tree. Also print some summary 2.628 // information. 2.629 -template <class Chunk_t, template <class> class FreeList_t> 2.630 +template <class Chunk_t, class FreeList_t> 2.631 class PrintTreeCensusClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.632 int _print_line; 2.633 size_t _total_free; 2.634 - FreeList_t<Chunk_t> _total; 2.635 + FreeList_t _total; 2.636 2.637 public: 2.638 PrintTreeCensusClosure() { 2.639 _print_line = 0; 2.640 _total_free = 0; 2.641 } 2.642 - FreeList_t<Chunk_t>* total() { return &_total; } 2.643 + FreeList_t* total() { return &_total; } 2.644 size_t total_free() { return _total_free; } 2.645 void do_list(FreeList<Chunk_t>* fl) { 2.646 if (++_print_line >= 40) { 2.647 - FreeList_t<Chunk_t>::print_labels_on(gclog_or_tty, "size"); 2.648 + FreeList_t::print_labels_on(gclog_or_tty, "size"); 2.649 _print_line = 0; 2.650 } 2.651 fl->print_on(gclog_or_tty); 2.652 @@ -1256,7 +1243,7 @@ 2.653 #if INCLUDE_ALL_GCS 2.654 void do_list(AdaptiveFreeList<Chunk_t>* fl) { 2.655 if (++_print_line >= 40) { 2.656 - FreeList_t<Chunk_t>::print_labels_on(gclog_or_tty, "size"); 2.657 + FreeList_t::print_labels_on(gclog_or_tty, "size"); 2.658 _print_line = 0; 2.659 } 2.660 fl->print_on(gclog_or_tty); 2.661 @@ -1275,16 +1262,16 @@ 2.662 #endif // INCLUDE_ALL_GCS 2.663 }; 2.664 2.665 -template <class Chunk_t, template <class> class FreeList_t> 2.666 +template <class Chunk_t, class FreeList_t> 2.667 void BinaryTreeDictionary<Chunk_t, FreeList_t>::print_dict_census(void) const { 2.668 2.669 gclog_or_tty->print("\nBinaryTree\n"); 2.670 - FreeList_t<Chunk_t>::print_labels_on(gclog_or_tty, "size"); 2.671 + FreeList_t::print_labels_on(gclog_or_tty, "size"); 2.672 PrintTreeCensusClosure<Chunk_t, FreeList_t> ptc; 2.673 ptc.do_tree(root()); 2.674 2.675 - FreeList_t<Chunk_t>* total = ptc.total(); 2.676 - FreeList_t<Chunk_t>::print_labels_on(gclog_or_tty, " "); 2.677 + FreeList_t* total = ptc.total(); 2.678 + FreeList_t::print_labels_on(gclog_or_tty, " "); 2.679 } 2.680 2.681 #if INCLUDE_ALL_GCS 2.682 @@ -1293,7 +1280,7 @@ 2.683 2.684 gclog_or_tty->print("\nBinaryTree\n"); 2.685 AdaptiveFreeList<FreeChunk>::print_labels_on(gclog_or_tty, "size"); 2.686 - PrintTreeCensusClosure<FreeChunk, AdaptiveFreeList> ptc; 2.687 + PrintTreeCensusClosure<FreeChunk, AdaptiveFreeList<FreeChunk> > ptc; 2.688 ptc.do_tree(root()); 2.689 2.690 AdaptiveFreeList<FreeChunk>* total = ptc.total(); 2.691 @@ -1311,7 +1298,7 @@ 2.692 } 2.693 #endif // INCLUDE_ALL_GCS 2.694 2.695 -template <class Chunk_t, template <class> class FreeList_t> 2.696 +template <class Chunk_t, class FreeList_t> 2.697 class PrintFreeListsClosure : public AscendTreeCensusClosure<Chunk_t, FreeList_t> { 2.698 outputStream* _st; 2.699 int _print_line; 2.700 @@ -1321,9 +1308,9 @@ 2.701 _st = st; 2.702 _print_line = 0; 2.703 } 2.704 - void do_list(FreeList_t<Chunk_t>* fl) { 2.705 + void do_list(FreeList_t* fl) { 2.706 if (++_print_line >= 40) { 2.707 - FreeList_t<Chunk_t>::print_labels_on(_st, "size"); 2.708 + FreeList_t::print_labels_on(_st, "size"); 2.709 _print_line = 0; 2.710 } 2.711 fl->print_on(gclog_or_tty); 2.712 @@ -1337,10 +1324,10 @@ 2.713 } 2.714 }; 2.715 2.716 -template <class Chunk_t, template <class> class FreeList_t> 2.717 +template <class Chunk_t, class FreeList_t> 2.718 void BinaryTreeDictionary<Chunk_t, FreeList_t>::print_free_lists(outputStream* st) const { 2.719 2.720 - FreeList_t<Chunk_t>::print_labels_on(st, "size"); 2.721 + FreeList_t::print_labels_on(st, "size"); 2.722 PrintFreeListsClosure<Chunk_t, FreeList_t> pflc(st); 2.723 pflc.do_tree(root()); 2.724 } 2.725 @@ -1349,7 +1336,7 @@ 2.726 // . _root has no parent 2.727 // . parent and child point to each other 2.728 // . each node's key correctly related to that of its child(ren) 2.729 -template <class Chunk_t, template <class> class FreeList_t> 2.730 +template <class Chunk_t, class FreeList_t> 2.731 void BinaryTreeDictionary<Chunk_t, FreeList_t>::verify_tree() const { 2.732 guarantee(root() == NULL || total_free_blocks() == 0 || 2.733 total_size() != 0, "_total_size should't be 0?"); 2.734 @@ -1357,7 +1344,7 @@ 2.735 verify_tree_helper(root()); 2.736 } 2.737 2.738 -template <class Chunk_t, template <class> class FreeList_t> 2.739 +template <class Chunk_t, class FreeList_t> 2.740 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::verify_prev_free_ptrs(TreeList<Chunk_t, FreeList_t>* tl) { 2.741 size_t ct = 0; 2.742 for (Chunk_t* curFC = tl->head(); curFC != NULL; curFC = curFC->next()) { 2.743 @@ -1371,7 +1358,7 @@ 2.744 // Note: this helper is recursive rather than iterative, so use with 2.745 // caution on very deep trees; and watch out for stack overflow errors; 2.746 // In general, to be used only for debugging. 2.747 -template <class Chunk_t, template <class> class FreeList_t> 2.748 +template <class Chunk_t, class FreeList_t> 2.749 void BinaryTreeDictionary<Chunk_t, FreeList_t>::verify_tree_helper(TreeList<Chunk_t, FreeList_t>* tl) const { 2.750 if (tl == NULL) 2.751 return; 2.752 @@ -1400,25 +1387,25 @@ 2.753 verify_tree_helper(tl->right()); 2.754 } 2.755 2.756 -template <class Chunk_t, template <class> class FreeList_t> 2.757 +template <class Chunk_t, class FreeList_t> 2.758 void BinaryTreeDictionary<Chunk_t, FreeList_t>::verify() const { 2.759 verify_tree(); 2.760 guarantee(total_size() == total_size_in_tree(root()), "Total Size inconsistency"); 2.761 } 2.762 2.763 -template class TreeList<Metablock, FreeList>; 2.764 -template class BinaryTreeDictionary<Metablock, FreeList>; 2.765 -template class TreeChunk<Metablock, FreeList>; 2.766 +template class TreeList<Metablock, FreeList<Metablock> >; 2.767 +template class BinaryTreeDictionary<Metablock, FreeList<Metablock> >; 2.768 +template class TreeChunk<Metablock, FreeList<Metablock> >; 2.769 2.770 -template class TreeList<Metachunk, FreeList>; 2.771 -template class BinaryTreeDictionary<Metachunk, FreeList>; 2.772 -template class TreeChunk<Metachunk, FreeList>; 2.773 +template class TreeList<Metachunk, FreeList<Metachunk> >; 2.774 +template class BinaryTreeDictionary<Metachunk, FreeList<Metachunk> >; 2.775 +template class TreeChunk<Metachunk, FreeList<Metachunk> >; 2.776 2.777 2.778 #if INCLUDE_ALL_GCS 2.779 // Explicitly instantiate these types for FreeChunk. 2.780 -template class TreeList<FreeChunk, AdaptiveFreeList>; 2.781 -template class BinaryTreeDictionary<FreeChunk, AdaptiveFreeList>; 2.782 -template class TreeChunk<FreeChunk, AdaptiveFreeList>; 2.783 +template class TreeList<FreeChunk, AdaptiveFreeList<FreeChunk> >; 2.784 +template class BinaryTreeDictionary<FreeChunk, AdaptiveFreeList<FreeChunk> >; 2.785 +template class TreeChunk<FreeChunk, AdaptiveFreeList<FreeChunk> >; 2.786 2.787 #endif // INCLUDE_ALL_GCS
3.1 --- a/src/share/vm/memory/binaryTreeDictionary.hpp Wed Feb 26 22:11:26 2014 +0100 3.2 +++ b/src/share/vm/memory/binaryTreeDictionary.hpp Tue Feb 11 09:34:50 2014 +0100 3.3 @@ -37,18 +37,18 @@ 3.4 // A TreeList is a FreeList which can be used to maintain a 3.5 // binary tree of free lists. 3.6 3.7 -template <class Chunk_t, template <class> class FreeList_t> class TreeChunk; 3.8 -template <class Chunk_t, template <class> class FreeList_t> class BinaryTreeDictionary; 3.9 -template <class Chunk_t, template <class> class FreeList_t> class AscendTreeCensusClosure; 3.10 -template <class Chunk_t, template <class> class FreeList_t> class DescendTreeCensusClosure; 3.11 -template <class Chunk_t, template <class> class FreeList_t> class DescendTreeSearchClosure; 3.12 +template <class Chunk_t, class FreeList_t> class TreeChunk; 3.13 +template <class Chunk_t, class FreeList_t> class BinaryTreeDictionary; 3.14 +template <class Chunk_t, class FreeList_t> class AscendTreeCensusClosure; 3.15 +template <class Chunk_t, class FreeList_t> class DescendTreeCensusClosure; 3.16 +template <class Chunk_t, class FreeList_t> class DescendTreeSearchClosure; 3.17 3.18 class FreeChunk; 3.19 template <class> class AdaptiveFreeList; 3.20 -typedef BinaryTreeDictionary<FreeChunk, AdaptiveFreeList> AFLBinaryTreeDictionary; 3.21 +typedef BinaryTreeDictionary<FreeChunk, AdaptiveFreeList<FreeChunk> > AFLBinaryTreeDictionary; 3.22 3.23 -template <class Chunk_t, template <class> class FreeList_t> 3.24 -class TreeList : public FreeList_t<Chunk_t> { 3.25 +template <class Chunk_t, class FreeList_t> 3.26 +class TreeList : public FreeList_t { 3.27 friend class TreeChunk<Chunk_t, FreeList_t>; 3.28 friend class BinaryTreeDictionary<Chunk_t, FreeList_t>; 3.29 friend class AscendTreeCensusClosure<Chunk_t, FreeList_t>; 3.30 @@ -66,12 +66,12 @@ 3.31 TreeList<Chunk_t, FreeList_t>* right() const { return _right; } 3.32 3.33 // Wrapper on call to base class, to get the template to compile. 3.34 - Chunk_t* head() const { return FreeList_t<Chunk_t>::head(); } 3.35 - Chunk_t* tail() const { return FreeList_t<Chunk_t>::tail(); } 3.36 - void set_head(Chunk_t* head) { FreeList_t<Chunk_t>::set_head(head); } 3.37 - void set_tail(Chunk_t* tail) { FreeList_t<Chunk_t>::set_tail(tail); } 3.38 + Chunk_t* head() const { return FreeList_t::head(); } 3.39 + Chunk_t* tail() const { return FreeList_t::tail(); } 3.40 + void set_head(Chunk_t* head) { FreeList_t::set_head(head); } 3.41 + void set_tail(Chunk_t* tail) { FreeList_t::set_tail(tail); } 3.42 3.43 - size_t size() const { return FreeList_t<Chunk_t>::size(); } 3.44 + size_t size() const { return FreeList_t::size(); } 3.45 3.46 // Accessors for links in tree. 3.47 3.48 @@ -90,7 +90,7 @@ 3.49 void clear_left() { _left = NULL; } 3.50 void clear_right() { _right = NULL; } 3.51 void clear_parent() { _parent = NULL; } 3.52 - void initialize() { clear_left(); clear_right(), clear_parent(); FreeList_t<Chunk_t>::initialize(); } 3.53 + void initialize() { clear_left(); clear_right(), clear_parent(); FreeList_t::initialize(); } 3.54 3.55 // For constructing a TreeList from a Tree chunk or 3.56 // address and size. 3.57 @@ -139,7 +139,7 @@ 3.58 // on the free list for a node in the tree and is only removed if 3.59 // it is the last chunk on the free list. 3.60 3.61 -template <class Chunk_t, template <class> class FreeList_t> 3.62 +template <class Chunk_t, class FreeList_t> 3.63 class TreeChunk : public Chunk_t { 3.64 friend class TreeList<Chunk_t, FreeList_t>; 3.65 TreeList<Chunk_t, FreeList_t>* _list; 3.66 @@ -173,7 +173,7 @@ 3.67 }; 3.68 3.69 3.70 -template <class Chunk_t, template <class> class FreeList_t> 3.71 +template <class Chunk_t, class FreeList_t> 3.72 class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> { 3.73 friend class VMStructs; 3.74 size_t _total_size;
4.1 --- a/src/share/vm/memory/metaspace.cpp Wed Feb 26 22:11:26 2014 +0100 4.2 +++ b/src/share/vm/memory/metaspace.cpp Tue Feb 11 09:34:50 2014 +0100 4.3 @@ -46,8 +46,8 @@ 4.4 #include "utilities/copy.hpp" 4.5 #include "utilities/debug.hpp" 4.6 4.7 -typedef BinaryTreeDictionary<Metablock, FreeList> BlockTreeDictionary; 4.8 -typedef BinaryTreeDictionary<Metachunk, FreeList> ChunkTreeDictionary; 4.9 +typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > BlockTreeDictionary; 4.10 +typedef BinaryTreeDictionary<Metachunk, FreeList<Metachunk> > ChunkTreeDictionary; 4.11 4.12 // Set this constant to enable slow integrity checking of the free chunk lists 4.13 const bool metaspace_slow_verify = false; 4.14 @@ -790,7 +790,7 @@ 4.15 return NULL; 4.16 } 4.17 4.18 - if (word_size < TreeChunk<Metablock, FreeList>::min_size()) { 4.19 + if (word_size < TreeChunk<Metablock, FreeList<Metablock> >::min_size()) { 4.20 // Dark matter. Too small for dictionary. 4.21 return NULL; 4.22 } 4.23 @@ -810,7 +810,7 @@ 4.24 MetaWord* new_block = (MetaWord*)free_block; 4.25 assert(block_size >= word_size, "Incorrect size of block from freelist"); 4.26 const size_t unused = block_size - word_size; 4.27 - if (unused >= TreeChunk<Metablock, FreeList>::min_size()) { 4.28 + if (unused >= TreeChunk<Metablock, FreeList<Metablock> >::min_size()) { 4.29 return_block(new_block + word_size, unused); 4.30 } 4.31 4.32 @@ -2239,7 +2239,7 @@ 4.33 void SpaceManager::deallocate(MetaWord* p, size_t word_size) { 4.34 assert_lock_strong(_lock); 4.35 size_t raw_word_size = get_raw_word_size(word_size); 4.36 - size_t min_size = TreeChunk<Metablock, FreeList>::min_size(); 4.37 + size_t min_size = TreeChunk<Metablock, FreeList<Metablock> >::min_size(); 4.38 assert(raw_word_size >= min_size, 4.39 err_msg("Should not deallocate dark matter " SIZE_FORMAT "<" SIZE_FORMAT, word_size, min_size)); 4.40 block_freelists()->return_block(p, raw_word_size); 4.41 @@ -2295,7 +2295,7 @@ 4.42 void SpaceManager::retire_current_chunk() { 4.43 if (current_chunk() != NULL) { 4.44 size_t remaining_words = current_chunk()->free_word_size(); 4.45 - if (remaining_words >= TreeChunk<Metablock, FreeList>::min_size()) { 4.46 + if (remaining_words >= TreeChunk<Metablock, FreeList<Metablock> >::min_size()) { 4.47 block_freelists()->return_block(current_chunk()->allocate(remaining_words), remaining_words); 4.48 inc_used_metrics(remaining_words); 4.49 } 4.50 @@ -3278,7 +3278,7 @@ 4.51 assert(Thread::current()->is_VM_thread(), "should be the VM thread"); 4.52 // Don't take Heap_lock 4.53 MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag); 4.54 - if (word_size < TreeChunk<Metablock, FreeList>::min_size()) { 4.55 + if (word_size < TreeChunk<Metablock, FreeList<Metablock> >::min_size()) { 4.56 // Dark matter. Too small for dictionary. 4.57 #ifdef ASSERT 4.58 Copy::fill_to_words((HeapWord*)ptr, word_size, 0xf5f5f5f5); 4.59 @@ -3293,7 +3293,7 @@ 4.60 } else { 4.61 MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag); 4.62 4.63 - if (word_size < TreeChunk<Metablock, FreeList>::min_size()) { 4.64 + if (word_size < TreeChunk<Metablock, FreeList<Metablock> >::min_size()) { 4.65 // Dark matter. Too small for dictionary. 4.66 #ifdef ASSERT 4.67 Copy::fill_to_words((HeapWord*)ptr, word_size, 0xf5f5f5f5);
5.1 --- a/src/share/vm/runtime/vmStructs.cpp Wed Feb 26 22:11:26 2014 +0100 5.2 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Feb 11 09:34:50 2014 +0100 5.3 @@ -242,7 +242,7 @@ 5.4 typedef Hashtable<Klass*, mtClass> KlassHashtable; 5.5 typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry; 5.6 typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable; 5.7 -typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; 5.8 +typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDictionary; 5.9 5.10 //-------------------------------------------------------------------------------- 5.11 // VM_STRUCTS