mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8214822: Move ConcurrentHashTable VALUE parameter to CONFIG
Make VALUE parameter be included in CONFIG configuration, also remove BaseConfig Reviewed-by: dholmes, kbarrett
This commit is contained in:
parent
13d3c63405
commit
cd598622cc
7 changed files with 205 additions and 231 deletions
|
@ -77,8 +77,7 @@ static OffsetCompactHashtable<
|
|||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
typedef ConcurrentHashTable<Symbol*,
|
||||
SymbolTableConfig, mtSymbol> SymbolTableHash;
|
||||
typedef ConcurrentHashTable<SymbolTableConfig, mtSymbol> SymbolTableHash;
|
||||
static SymbolTableHash* _local_table = NULL;
|
||||
|
||||
volatile bool SymbolTable::_has_work = 0;
|
||||
|
@ -121,10 +120,12 @@ static uintx hash_shared_symbol(const char* s, int len) {
|
|||
}
|
||||
#endif
|
||||
|
||||
class SymbolTableConfig : public SymbolTableHash::BaseConfig {
|
||||
class SymbolTableConfig : public AllStatic {
|
||||
private:
|
||||
public:
|
||||
static uintx get_hash(Symbol* const& value, bool* is_dead) {
|
||||
typedef Symbol* Value; // value of the Node in the hashtable
|
||||
|
||||
static uintx get_hash(Value const& value, bool* is_dead) {
|
||||
*is_dead = (value->refcount() == 0);
|
||||
if (*is_dead) {
|
||||
return 0;
|
||||
|
@ -133,11 +134,11 @@ public:
|
|||
}
|
||||
}
|
||||
// We use default allocation/deallocation but counted
|
||||
static void* allocate_node(size_t size, Symbol* const& value) {
|
||||
static void* allocate_node(size_t size, Value const& value) {
|
||||
SymbolTable::item_added();
|
||||
return SymbolTableHash::BaseConfig::allocate_node(size, value);
|
||||
return AllocateHeap(size, mtSymbol);
|
||||
}
|
||||
static void free_node(void* memory, Symbol* const& value) {
|
||||
static void free_node(void* memory, Value const& value) {
|
||||
// We get here because #1 some threads lost a race to insert a newly created Symbol
|
||||
// or #2 we're cleaning up unused symbol.
|
||||
// If #1, then the symbol can be either permanent (refcount==PERM_REFCOUNT),
|
||||
|
@ -150,7 +151,7 @@ public:
|
|||
assert(value->refcount() == 0, "expected dead symbol");
|
||||
}
|
||||
SymbolTable::delete_symbol(value);
|
||||
SymbolTableHash::BaseConfig::free_node(memory, value);
|
||||
FreeHeap(memory);
|
||||
SymbolTable::item_removed();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue