OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #define HMM_PROCESS | 74 #define HMM_PROCESS |
75 #endif | 75 #endif |
76 | 76 |
77 #endif | 77 #endif |
78 | 78 |
79 #ifdef HMM_PROCESS | 79 #ifdef HMM_PROCESS |
80 | 80 |
81 #include "hmm_cnfg.h" | 81 #include "hmm_cnfg.h" |
82 | 82 |
83 /* Heap descriptor. */ | 83 /* Heap descriptor. */ |
84 typedef struct HMM_UNIQUE(structure) | 84 typedef struct HMM_UNIQUE(structure) { |
85 { | 85 /* private: */ |
86 /* private: */ | |
87 | 86 |
88 /* Pointer to (payload of) root node in AVL tree. This field should | 87 /* Pointer to (payload of) root node in AVL tree. This field should |
89 ** really be the AVL tree descriptor (type avl_avl). But (in the | 88 ** really be the AVL tree descriptor (type avl_avl). But (in the |
90 ** instantiation of the AVL tree generic package used in package) the | 89 ** instantiation of the AVL tree generic package used in package) the |
91 ** AVL tree descriptor simply contains a pointer to the root. So, | 90 ** AVL tree descriptor simply contains a pointer to the root. So, |
92 ** whenever a pointer to the AVL tree descriptor is needed, I use the | 91 ** whenever a pointer to the AVL tree descriptor is needed, I use the |
93 ** cast: | 92 ** cast: |
94 ** | 93 ** |
95 ** (avl_avl *) &(heap_desc->avl_tree_root) | 94 ** (avl_avl *) &(heap_desc->avl_tree_root) |
96 ** | 95 ** |
97 ** (where heap_desc is a pointer to a heap descriptor). This trick | 96 ** (where heap_desc is a pointer to a heap descriptor). This trick |
98 ** allows me to avoid including cavl_if.h in this external header. */ | 97 ** allows me to avoid including cavl_if.h in this external header. */ |
99 void *avl_tree_root; | 98 void *avl_tree_root; |
100 | 99 |
101 /* Pointer to first byte of last block freed, after any coalescing. */ | 100 /* Pointer to first byte of last block freed, after any coalescing. */ |
102 void *last_freed; | 101 void *last_freed; |
103 | 102 |
104 /* public: */ | 103 /* public: */ |
105 | 104 |
106 HMM_UNIQUE(size_bau) num_baus_can_shrink; | 105 HMM_UNIQUE(size_bau) num_baus_can_shrink; |
107 void *end_of_shrinkable_chunk; | 106 void *end_of_shrinkable_chunk; |
108 } | 107 } |
109 HMM_UNIQUE(descriptor); | 108 HMM_UNIQUE(descriptor); |
110 | 109 |
111 /* Prototypes for externally-callable functions. */ | 110 /* Prototypes for externally-callable functions. */ |
112 | 111 |
113 void HMM_UNIQUE(init)(HMM_UNIQUE(descriptor) *desc); | 112 void HMM_UNIQUE(init)(HMM_UNIQUE(descriptor) *desc); |
114 | 113 |
115 void *HMM_UNIQUE(alloc)( | 114 void *HMM_UNIQUE(alloc)( |
116 HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) num_addr_align_units); | 115 HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) num_addr_align_units); |
117 | 116 |
118 /* NOT YET IMPLEMENTED */ | 117 /* NOT YET IMPLEMENTED */ |
119 void *HMM_UNIQUE(greedy_alloc)( | 118 void *HMM_UNIQUE(greedy_alloc)( |
120 HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) needed_addr_align_units, | 119 HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) needed_addr_align_units, |
121 HMM_UNIQUE(size_aau) coveted_addr_align_units); | 120 HMM_UNIQUE(size_aau) coveted_addr_align_units); |
122 | 121 |
123 int HMM_UNIQUE(resize)( | 122 int HMM_UNIQUE(resize)( |
124 HMM_UNIQUE(descriptor) *desc, void *mem, | 123 HMM_UNIQUE(descriptor) *desc, void *mem, |
125 HMM_UNIQUE(size_aau) num_addr_align_units); | 124 HMM_UNIQUE(size_aau) num_addr_align_units); |
126 | 125 |
127 /* NOT YET IMPLEMENTED */ | 126 /* NOT YET IMPLEMENTED */ |
128 int HMM_UNIQUE(greedy_resize)( | 127 int HMM_UNIQUE(greedy_resize)( |
129 HMM_UNIQUE(descriptor) *desc, void *mem, | 128 HMM_UNIQUE(descriptor) *desc, void *mem, |
130 HMM_UNIQUE(size_aau) needed_addr_align_units, | 129 HMM_UNIQUE(size_aau) needed_addr_align_units, |
131 HMM_UNIQUE(size_aau) coveted_addr_align_units); | 130 HMM_UNIQUE(size_aau) coveted_addr_align_units); |
132 | 131 |
133 void HMM_UNIQUE(free)(HMM_UNIQUE(descriptor) *desc, void *mem); | 132 void HMM_UNIQUE(free)(HMM_UNIQUE(descriptor) *desc, void *mem); |
134 | 133 |
135 HMM_UNIQUE(size_aau) HMM_UNIQUE(true_size)(void *mem); | 134 HMM_UNIQUE(size_aau) HMM_UNIQUE(true_size)(void *mem); |
136 | 135 |
137 HMM_UNIQUE(size_aau) HMM_UNIQUE(largest_available)( | 136 HMM_UNIQUE(size_aau) HMM_UNIQUE(largest_available)( |
138 HMM_UNIQUE(descriptor) *desc); | 137 HMM_UNIQUE(descriptor) *desc); |
139 | 138 |
140 void HMM_UNIQUE(new_chunk)( | 139 void HMM_UNIQUE(new_chunk)( |
141 HMM_UNIQUE(descriptor) *desc, void *start_of_chunk, | 140 HMM_UNIQUE(descriptor) *desc, void *start_of_chunk, |
142 HMM_UNIQUE(size_bau) num_block_align_units); | 141 HMM_UNIQUE(size_bau) num_block_align_units); |
143 | 142 |
144 void HMM_UNIQUE(grow_chunk)( | 143 void HMM_UNIQUE(grow_chunk)( |
145 HMM_UNIQUE(descriptor) *desc, void *end_of_chunk, | 144 HMM_UNIQUE(descriptor) *desc, void *end_of_chunk, |
146 HMM_UNIQUE(size_bau) num_block_align_units); | 145 HMM_UNIQUE(size_bau) num_block_align_units); |
147 | 146 |
148 /* NOT YET IMPLEMENTED */ | 147 /* NOT YET IMPLEMENTED */ |
149 void HMM_UNIQUE(shrink_chunk)( | 148 void HMM_UNIQUE(shrink_chunk)( |
150 HMM_UNIQUE(descriptor) *desc, | 149 HMM_UNIQUE(descriptor) *desc, |
151 HMM_UNIQUE(size_bau) num_block_align_units); | 150 HMM_UNIQUE(size_bau) num_block_align_units); |
152 | 151 |
153 #endif /* defined HMM_PROCESS */ | 152 #endif /* defined HMM_PROCESS */ |
OLD | NEW |