RFR: 8301992: Embed SymbolTable CHT node

Coleen Phillimore coleenp at openjdk.org
Wed Feb 15 00:54:51 UTC 2023


On Tue, 14 Feb 2023 17:29:41 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> Please review this patch for embedding the Symbol inside a ConcurrentHashTable Node instead of having a pointer to a Symbol. This eliminates malloc/free for each Symbol.
> 
> This patch is co-authored by @robehn.
> 
> Passed tiers 1 - 4 testing.

This looks good - I have just a couple of changes that I think you should make.

src/hotspot/share/classfile/symbolTable.cpp line 469:

> 467:   const int alloc_size = Symbol::byte_size(len);
> 468:   u1* u1_buf = NEW_RESOURCE_ARRAY(u1, alloc_size);
> 469:   Symbol* tmp = ::new ((void*)u1_buf) Symbol((const u1*)name, len, (heap && !DumpSharedSpaces) ? 1 : PERM_REFCOUNT);

There's a version of NEW_RESOURCE_ARRAY that takes the Thread argument, so it doesn't have to call Thread::current()

src/hotspot/share/oops/symbol.cpp line 68:

> 66: }
> 67: 
> 68: Symbol::Symbol(const Symbol& s1) {

Can you add a comment that this copies the symbol when added to the ConcurrentHashTable.

-------------

Changes requested by coleenp (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12562


More information about the hotspot-dev mailing list