comparison src/share/vm/memory/binaryTreeDictionary.hpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 89152779163c ab36007d6358
children
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
35 */ 35 */
36 36
37 // A TreeList is a FreeList which can be used to maintain a 37 // A TreeList is a FreeList which can be used to maintain a
38 // binary tree of free lists. 38 // binary tree of free lists.
39 39
40 template <class Chunk_t, template <class> class FreeList_t> class TreeChunk; 40 template <class Chunk_t, class FreeList_t> class TreeChunk;
41 template <class Chunk_t, template <class> class FreeList_t> class BinaryTreeDictionary; 41 template <class Chunk_t, class FreeList_t> class BinaryTreeDictionary;
42 template <class Chunk_t, template <class> class FreeList_t> class AscendTreeCensusClosure; 42 template <class Chunk_t, class FreeList_t> class AscendTreeCensusClosure;
43 template <class Chunk_t, template <class> class FreeList_t> class DescendTreeCensusClosure; 43 template <class Chunk_t, class FreeList_t> class DescendTreeCensusClosure;
44 template <class Chunk_t, template <class> class FreeList_t> class DescendTreeSearchClosure; 44 template <class Chunk_t, class FreeList_t> class DescendTreeSearchClosure;
45 45
46 class FreeChunk; 46 class FreeChunk;
47 template <class> class AdaptiveFreeList; 47 template <class> class AdaptiveFreeList;
48 typedef BinaryTreeDictionary<FreeChunk, AdaptiveFreeList> AFLBinaryTreeDictionary; 48 typedef BinaryTreeDictionary<FreeChunk, AdaptiveFreeList<FreeChunk> > AFLBinaryTreeDictionary;
49 49
50 template <class Chunk_t, template <class> class FreeList_t> 50 template <class Chunk_t, class FreeList_t>
51 class TreeList : public FreeList_t<Chunk_t> { 51 class TreeList : public FreeList_t {
52 friend class TreeChunk<Chunk_t, FreeList_t>; 52 friend class TreeChunk<Chunk_t, FreeList_t>;
53 friend class BinaryTreeDictionary<Chunk_t, FreeList_t>; 53 friend class BinaryTreeDictionary<Chunk_t, FreeList_t>;
54 friend class AscendTreeCensusClosure<Chunk_t, FreeList_t>; 54 friend class AscendTreeCensusClosure<Chunk_t, FreeList_t>;
55 friend class DescendTreeCensusClosure<Chunk_t, FreeList_t>; 55 friend class DescendTreeCensusClosure<Chunk_t, FreeList_t>;
56 friend class DescendTreeSearchClosure<Chunk_t, FreeList_t>; 56 friend class DescendTreeSearchClosure<Chunk_t, FreeList_t>;
64 TreeList<Chunk_t, FreeList_t>* parent() const { return _parent; } 64 TreeList<Chunk_t, FreeList_t>* parent() const { return _parent; }
65 TreeList<Chunk_t, FreeList_t>* left() const { return _left; } 65 TreeList<Chunk_t, FreeList_t>* left() const { return _left; }
66 TreeList<Chunk_t, FreeList_t>* right() const { return _right; } 66 TreeList<Chunk_t, FreeList_t>* right() const { return _right; }
67 67
68 // Wrapper on call to base class, to get the template to compile. 68 // Wrapper on call to base class, to get the template to compile.
69 Chunk_t* head() const { return FreeList_t<Chunk_t>::head(); } 69 Chunk_t* head() const { return FreeList_t::head(); }
70 Chunk_t* tail() const { return FreeList_t<Chunk_t>::tail(); } 70 Chunk_t* tail() const { return FreeList_t::tail(); }
71 void set_head(Chunk_t* head) { FreeList_t<Chunk_t>::set_head(head); } 71 void set_head(Chunk_t* head) { FreeList_t::set_head(head); }
72 void set_tail(Chunk_t* tail) { FreeList_t<Chunk_t>::set_tail(tail); } 72 void set_tail(Chunk_t* tail) { FreeList_t::set_tail(tail); }
73 73
74 size_t size() const { return FreeList_t<Chunk_t>::size(); } 74 size_t size() const { return FreeList_t::size(); }
75 75
76 // Accessors for links in tree. 76 // Accessors for links in tree.
77 77
78 void set_left(TreeList<Chunk_t, FreeList_t>* tl) { 78 void set_left(TreeList<Chunk_t, FreeList_t>* tl) {
79 _left = tl; 79 _left = tl;
88 void set_parent(TreeList<Chunk_t, FreeList_t>* tl) { _parent = tl; } 88 void set_parent(TreeList<Chunk_t, FreeList_t>* tl) { _parent = tl; }
89 89
90 void clear_left() { _left = NULL; } 90 void clear_left() { _left = NULL; }
91 void clear_right() { _right = NULL; } 91 void clear_right() { _right = NULL; }
92 void clear_parent() { _parent = NULL; } 92 void clear_parent() { _parent = NULL; }
93 void initialize() { clear_left(); clear_right(), clear_parent(); FreeList_t<Chunk_t>::initialize(); } 93 void initialize() { clear_left(); clear_right(), clear_parent(); FreeList_t::initialize(); }
94 94
95 // For constructing a TreeList from a Tree chunk or 95 // For constructing a TreeList from a Tree chunk or
96 // address and size. 96 // address and size.
97 TreeList(); 97 TreeList();
98 static TreeList<Chunk_t, FreeList_t>* 98 static TreeList<Chunk_t, FreeList_t>*
137 // the first chunk in the list is distinguished in this fashion 137 // the first chunk in the list is distinguished in this fashion
138 // (also is the node in the tree), it is the last chunk to be found 138 // (also is the node in the tree), it is the last chunk to be found
139 // on the free list for a node in the tree and is only removed if 139 // on the free list for a node in the tree and is only removed if
140 // it is the last chunk on the free list. 140 // it is the last chunk on the free list.
141 141
142 template <class Chunk_t, template <class> class FreeList_t> 142 template <class Chunk_t, class FreeList_t>
143 class TreeChunk : public Chunk_t { 143 class TreeChunk : public Chunk_t {
144 friend class TreeList<Chunk_t, FreeList_t>; 144 friend class TreeList<Chunk_t, FreeList_t>;
145 TreeList<Chunk_t, FreeList_t>* _list; 145 TreeList<Chunk_t, FreeList_t>* _list;
146 TreeList<Chunk_t, FreeList_t> _embedded_list; // if non-null, this chunk is on _list 146 TreeList<Chunk_t, FreeList_t> _embedded_list; // if non-null, this chunk is on _list
147 147
171 void verify_tree_chunk_list() const; 171 void verify_tree_chunk_list() const;
172 void assert_is_mangled() const; 172 void assert_is_mangled() const;
173 }; 173 };
174 174
175 175
176 template <class Chunk_t, template <class> class FreeList_t> 176 template <class Chunk_t, class FreeList_t>
177 class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> { 177 class BinaryTreeDictionary: public FreeBlockDictionary<Chunk_t> {
178 friend class VMStructs; 178 friend class VMStructs;
179 size_t _total_size; 179 size_t _total_size;
180 size_t _total_free_blocks; 180 size_t _total_free_blocks;
181 TreeList<Chunk_t, FreeList_t>* _root; 181 TreeList<Chunk_t, FreeList_t>* _root;