equal
deleted
inserted
replaced
59 template <MEMFLAGS F> BasicHashtableEntry<F>* BasicHashtable<F>::new_entry(unsigned int hashValue) { |
59 template <MEMFLAGS F> BasicHashtableEntry<F>* BasicHashtable<F>::new_entry(unsigned int hashValue) { |
60 BasicHashtableEntry<F>* entry = new_entry_free_list(); |
60 BasicHashtableEntry<F>* entry = new_entry_free_list(); |
61 |
61 |
62 if (entry == NULL) { |
62 if (entry == NULL) { |
63 if (_first_free_entry + _entry_size >= _end_block) { |
63 if (_first_free_entry + _entry_size >= _end_block) { |
64 int block_size = MIN2(512, MAX2((int)_table_size / 2, (int)_number_of_entries)); |
64 int block_size = MIN2(512, MAX3(2, (int)_table_size / 2, (int)_number_of_entries)); |
65 int len = _entry_size * block_size; |
65 int len = _entry_size * block_size; |
66 len = 1 << log2_int(len); // round down to power of 2 |
66 len = 1 << log2_int(len); // round down to power of 2 |
67 assert(len >= _entry_size, ""); |
67 assert(len >= _entry_size, ""); |
68 _first_free_entry = NEW_C_HEAP_ARRAY2(char, len, F, CURRENT_PC); |
68 _first_free_entry = NEW_C_HEAP_ARRAY2(char, len, F, CURRENT_PC); |
69 _entry_blocks->append(_first_free_entry); |
69 _entry_blocks->append(_first_free_entry); |