8213346: Re-implement shared dictionary using CompactHashtable

Reviewed-by: jiangli
This commit is contained in:
Ioi Lam 2018-11-07 19:40:27 -08:00
parent 14b8e187e2
commit 147fc3ed13
31 changed files with 832 additions and 1049 deletions

View file

@ -57,9 +57,6 @@
#define ON_STACK_BUFFER_LENGTH 128
// --------------------------------------------------------------------------
inline Symbol* read_symbol_from_compact_hashtable(address base_address, u4 offset) {
return (Symbol*)(base_address + offset);
}
inline bool symbol_equals_compact_hashtable_entry(Symbol* value, const char* key, int len) {
if (value->equals(key, len)) {
@ -70,9 +67,8 @@ inline bool symbol_equals_compact_hashtable_entry(Symbol* value, const char* key
}
}
static CompactHashtable<
static OffsetCompactHashtable<
const char*, Symbol*,
read_symbol_from_compact_hashtable,
symbol_equals_compact_hashtable_entry
> _shared_table;
@ -637,16 +633,7 @@ struct CopyToArchive : StackObj {
unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
"must not rehash during dumping");
uintx deltax = MetaspaceShared::object_delta(sym);
// When the symbols are stored into the archive, we already check that
// they won't be more than MAX_SHARED_DELTA from the base address, or
// else the dumping would have been aborted.
assert(deltax <= MAX_SHARED_DELTA, "must not be");
u4 delta = u4(deltax);
// add to the compact table
_writer->add(fixed_hash, delta);
_writer->add(fixed_hash, MetaspaceShared::object_delta_u4(sym));
return true;
}
};