RFR: 8301992: Embed SymbolTable CHT node [v3]

Coleen Phillimore coleenp at openjdk.org
Thu Feb 16 00:28:43 UTC 2023


On Wed, 15 Feb 2023 23:37:15 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   remove unused allocate_symbol() declaration in symbolTable.hpp
>
> src/hotspot/share/classfile/symbolTable.cpp line 161:
> 
>> 159:       FreeHeap(memory);
>> 160:       SymbolTable::item_removed();
>> 161:     }
> 
> We don’t call afree() anymore if the symbol is permanent. . Is this intentional?
> 
> Actually the old code has a bug. A non permanent symbol allocated from the c heap can overflow the refcount and become permanent. If it needs to be freed, we cannot call afree.
> 
> Anyway, how is it possible for a permanent symbol to be freed here? Maybe this should be changed to an assert?

Yes, it seemed dubious if we ever freed the entry from the symbol arena, so I think it's ok.  It would only free the Symbol if it was the last one allocated and there was a race when inserting the same permanent symbol in the table.

You're right there would be a bug if we tried to free a CHeap allocated symbol from the arena if the refcount became permanent.  I'm not sure what would happen in that case.

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

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


More information about the hotspot-dev mailing list