6770949: minor tweaks before 6655638

Minor cleanups & tuning of array.hpp, debug.cpp, growableArray.hpp, hashtable.cpp

Reviewed-by: kvn
This commit is contained in:
John R Rose 2008-11-12 23:26:45 -08:00
parent 849e0ffb04
commit 4e2c4fb4bd
4 changed files with 63 additions and 20 deletions

View file

@ -43,9 +43,11 @@ BasicHashtableEntry* BasicHashtable::new_entry(unsigned int hashValue) {
entry = _free_list;
_free_list = _free_list->next();
} else {
const int block_size = 500;
if (_first_free_entry == _end_block) {
if (_first_free_entry + _entry_size >= _end_block) {
int block_size = MIN2(512, MAX2((int)_table_size / 2, (int)_number_of_entries));
int len = _entry_size * block_size;
len = 1 << log2_intptr(len); // round down to power of 2
assert(len >= _entry_size, "");
_first_free_entry = NEW_C_HEAP_ARRAY(char, len);
_end_block = _first_free_entry + len;
}
@ -53,6 +55,7 @@ BasicHashtableEntry* BasicHashtable::new_entry(unsigned int hashValue) {
_first_free_entry += _entry_size;
}
assert(_entry_size % HeapWordSize == 0, "");
entry->set_hash(hashValue);
return entry;
}