mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8221967: InternTest.java timed out
Move redundant table lookup and make rehashing be a needed guaranteed safepoint cleanup action. Reviewed-by: dholmes, rehn
This commit is contained in:
parent
b08841af0d
commit
e47584d00d
3 changed files with 16 additions and 8 deletions
|
@ -372,16 +372,19 @@ oop StringTable::do_intern(Handle string_or_null_h, const jchar* name,
|
||||||
|
|
||||||
bool rehash_warning;
|
bool rehash_warning;
|
||||||
do {
|
do {
|
||||||
if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
|
// Callers have already looked up the String using the jchar* name, so just go to add.
|
||||||
update_needs_rehash(rehash_warning);
|
|
||||||
return stg.get_res_oop();
|
|
||||||
}
|
|
||||||
WeakHandle<vm_string_table_data> wh = WeakHandle<vm_string_table_data>::create(string_h);
|
WeakHandle<vm_string_table_data> wh = WeakHandle<vm_string_table_data>::create(string_h);
|
||||||
// The hash table takes ownership of the WeakHandle, even if it's not inserted.
|
// The hash table takes ownership of the WeakHandle, even if it's not inserted.
|
||||||
if (_local_table->insert(THREAD, lookup, wh, &rehash_warning)) {
|
if (_local_table->insert(THREAD, lookup, wh, &rehash_warning)) {
|
||||||
update_needs_rehash(rehash_warning);
|
update_needs_rehash(rehash_warning);
|
||||||
return wh.resolve();
|
return wh.resolve();
|
||||||
}
|
}
|
||||||
|
// In case another thread did a concurrent add, return value already in the table.
|
||||||
|
// This could fail if the String got gc'ed concurrently, so loop back until success.
|
||||||
|
if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
|
||||||
|
update_needs_rehash(rehash_warning);
|
||||||
|
return stg.get_res_oop();
|
||||||
|
}
|
||||||
} while(true);
|
} while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -481,14 +481,17 @@ Symbol* SymbolTable::do_add_if_needed(const char* name, int len, uintx hash, boo
|
||||||
Thread* THREAD = Thread::current();
|
Thread* THREAD = Thread::current();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
|
// Callers have looked up the symbol once, insert the symbol.
|
||||||
sym = stg.get_res_sym();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sym = allocate_symbol(name, len, heap);
|
sym = allocate_symbol(name, len, heap);
|
||||||
if (_local_table->insert(THREAD, lookup, sym, &rehash_warning, &clean_hint)) {
|
if (_local_table->insert(THREAD, lookup, sym, &rehash_warning, &clean_hint)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// In case another thread did a concurrent add, return value already in the table.
|
||||||
|
// This could fail if the symbol got deleted concurrently, so loop back until success.
|
||||||
|
if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
|
||||||
|
sym = stg.get_res_sym();
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while(true);
|
} while(true);
|
||||||
|
|
||||||
update_needs_rehash(rehash_warning);
|
update_needs_rehash(rehash_warning);
|
||||||
|
|
|
@ -516,6 +516,8 @@ bool SafepointSynchronize::is_cleanup_needed() {
|
||||||
if (ObjectSynchronizer::is_cleanup_needed()) return true;
|
if (ObjectSynchronizer::is_cleanup_needed()) return true;
|
||||||
// Need a safepoint if some inline cache buffers is non-empty
|
// Need a safepoint if some inline cache buffers is non-empty
|
||||||
if (!InlineCacheBuffer::is_empty()) return true;
|
if (!InlineCacheBuffer::is_empty()) return true;
|
||||||
|
if (StringTable::needs_rehashing()) return true;
|
||||||
|
if (SymbolTable::needs_rehashing()) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue