RFR: 8327156: Avoid copying in StringTable::intern(oop, TRAPS) [v3]

Casper Norrbin cnorrbin at openjdk.org
Wed Oct 23 13:54:07 UTC 2024


On Tue, 22 Oct 2024 03:59:13 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   missed cleanup
>
> src/hotspot/share/oops/symbol.hpp line 262:
> 
>> 260: 
>> 261:   // Returns the non-null-terminated utf8 string stored in the symbol
>> 262:   const char* get_utf8() const { return reinterpret_cast<const char*>(bytes()); }
> 
> Not sure this really helps as it will cause confusion between `as_utf8` and `get_utf8`. A `Symbol` is a canonicalized string in modified UTF8 form - so `bytes` is that raw representation.

I moved this to a private `StringTable` function instead to reduce confusion. It is used quite a few times there, so was created more for convenience and readability.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21325#discussion_r1812820400


More information about the hotspot-dev mailing list