190 // The following method is not MT-safe and must be done under lock. |
193 // The following method is not MT-safe and must be done under lock. |
191 BasicHashtableEntry** bucket_addr(int i) { return _buckets[i].entry_addr(); } |
194 BasicHashtableEntry** bucket_addr(int i) { return _buckets[i].entry_addr(); } |
192 |
195 |
193 // Table entry management |
196 // Table entry management |
194 BasicHashtableEntry* new_entry(unsigned int hashValue); |
197 BasicHashtableEntry* new_entry(unsigned int hashValue); |
|
198 |
|
199 // Check that the table is unbalanced |
|
200 bool check_rehash_table(int count); |
|
201 |
|
202 // Used when moving the entry to another table |
|
203 // Clean up links, but do not add to free_list |
|
204 void unlink_entry(BasicHashtableEntry* entry) { |
|
205 entry->set_next(NULL); |
|
206 --_number_of_entries; |
|
207 } |
|
208 |
|
209 // Move over freelist and free block for allocation |
|
210 void copy_freelist(BasicHashtable* src) { |
|
211 _free_list = src->_free_list; |
|
212 src->_free_list = NULL; |
|
213 _first_free_entry = src->_first_free_entry; |
|
214 src->_first_free_entry = NULL; |
|
215 _end_block = src->_end_block; |
|
216 src->_end_block = NULL; |
|
217 } |
|
218 |
|
219 // Free the buckets in this hashtable |
|
220 void free_buckets() { |
|
221 if (NULL != _buckets) { |
|
222 FREE_C_HEAP_ARRAY(HashtableBucket, _buckets); |
|
223 _buckets = NULL; |
|
224 } |
|
225 } |
195 |
226 |
196 public: |
227 public: |
197 int table_size() { return _table_size; } |
228 int table_size() { return _table_size; } |
198 void set_entry(int index, BasicHashtableEntry* entry); |
229 void set_entry(int index, BasicHashtableEntry* entry); |
199 |
230 |
247 |
278 |
248 // The following method is not MT-safe and must be done under lock. |
279 // The following method is not MT-safe and must be done under lock. |
249 HashtableEntry<T>** bucket_addr(int i) { |
280 HashtableEntry<T>** bucket_addr(int i) { |
250 return (HashtableEntry<T>**)BasicHashtable::bucket_addr(i); |
281 return (HashtableEntry<T>**)BasicHashtable::bucket_addr(i); |
251 } |
282 } |
|
283 |
|
284 // Function to move these elements into the new table. |
|
285 void move_to(Hashtable<T>* new_table); |
|
286 virtual unsigned int new_hash(T) { ShouldNotReachHere(); return 0; } // should be overridden |
252 }; |
287 }; |
253 |
288 |
254 |
289 |
255 // Verions of hashtable where two handles are used to compute the index. |
290 // Verions of hashtable where two handles are used to compute the index. |
256 |
291 |