mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8306738: Select num workers for safepoint ParallelCleanupTask
Reviewed-by: shade, coleenp, tschatzl
This commit is contained in:
parent
a05560d993
commit
672bade522
7 changed files with 116 additions and 12 deletions
|
@ -103,6 +103,7 @@ static THREAD_LOCAL bool _lookup_shared_first = false;
|
|||
// Static arena for symbols that are not deallocated
|
||||
Arena* SymbolTable::_arena = nullptr;
|
||||
|
||||
static bool _rehashed = false;
|
||||
static uint64_t _alt_hash_seed = 0;
|
||||
|
||||
static inline void log_trace_symboltable_helper(Symbol* sym, const char* msg) {
|
||||
|
@ -805,13 +806,39 @@ bool SymbolTable::do_rehash() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SymbolTable::should_grow() {
|
||||
return get_load_factor() > PREF_AVG_LIST_LEN && !_local_table->is_max_size_reached();
|
||||
}
|
||||
|
||||
bool SymbolTable::rehash_table_expects_safepoint_rehashing() {
|
||||
// No rehashing required
|
||||
if (!needs_rehashing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Grow instead of rehash
|
||||
if (should_grow()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Already rehashed
|
||||
if (_rehashed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Resizing in progress
|
||||
if (!_local_table->is_safepoint_safe()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SymbolTable::rehash_table() {
|
||||
static bool rehashed = false;
|
||||
log_debug(symboltable)("Table imbalanced, rehashing called.");
|
||||
|
||||
// Grow instead of rehash.
|
||||
if (get_load_factor() > PREF_AVG_LIST_LEN &&
|
||||
!_local_table->is_max_size_reached()) {
|
||||
if (should_grow()) {
|
||||
log_debug(symboltable)("Choosing growing over rehashing.");
|
||||
trigger_cleanup();
|
||||
_needs_rehashing = false;
|
||||
|
@ -819,7 +846,7 @@ void SymbolTable::rehash_table() {
|
|||
}
|
||||
|
||||
// Already rehashed.
|
||||
if (rehashed) {
|
||||
if (_rehashed) {
|
||||
log_warning(symboltable)("Rehashing already done, still long lists.");
|
||||
trigger_cleanup();
|
||||
_needs_rehashing = false;
|
||||
|
@ -829,7 +856,7 @@ void SymbolTable::rehash_table() {
|
|||
_alt_hash_seed = AltHashing::compute_seed();
|
||||
|
||||
if (do_rehash()) {
|
||||
rehashed = true;
|
||||
_rehashed = true;
|
||||
} else {
|
||||
log_info(symboltable)("Resizes in progress rehashing skipped.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue