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

Casper Norrbin cnorrbin at openjdk.org
Wed Nov 13 12:01:39 UTC 2024


On Wed, 13 Nov 2024 08:29:02 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Casper Norrbin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision:
>> 
>>  - more feedback + formatting
>>  - Merge branch 'master' into stringtable--intern-refactor
>>  - size moved to wrapper
>>  - feedback from david
>>  - missed cleanup
>>  - length param change + feedback
>>  - feedback from johan
>>  - string conversion + intern tests
>>  - multi-type string interning
>
> src/hotspot/share/classfile/javaClasses.hpp line 184:
> 
>> 182:   }
>> 183: 
>> 184:   static unsigned int hash_code(const char* utf8_str, size_t utf8_len) {
> 
> Why is this inlined but the oop-version isn't? Maybe they should both be in the cpp file?

It's inlined because the hash functions working on unicode are inlined just above it. For the full context:

https://github.com/openjdk/jdk/blob/d55552d5323ff8a4ec37c320199b650e63f230b4/src/hotspot/share/classfile/javaClasses.hpp?plain=1#L166-L197

I think these are simple enough to be ok inlined, whereas the oop-versions are more complex and modify the object, so it makes sense that they are not.

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

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


More information about the hotspot-dev mailing list