RFR: 8327156: Avoid copying in StringTable::intern(oop, TRAPS) [v6]
Casper Norrbin
cnorrbin at openjdk.org
Tue Nov 12 15:11:11 UTC 2024
On Tue, 12 Nov 2024 00:04:12 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Casper Norrbin has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>>
>> size moved to wrapper
>
> src/hotspot/share/classfile/stringTable.cpp line 445:
>
>> 443: }
>> 444:
>> 445: Handle StringTable::to_handle(StringWrapper wrapped_str, TRAPS) {
>
> `to_handle` is a bit too generic - it's like saying `to_pointer`. You are returning the Handle form of a java.lang.String oop.
Renamed this to `handle_from_wrapped_string`, should be clearer and less ambiguous.
> src/hotspot/share/classfile/stringTable.hpp line 83:
>
>> 81: typedef struct StringWrapperInternal StringWrapper;
>> 82:
>> 83: static bool wrapped_string_equals(oop java_string, StringWrapper wrapped_str, int _ = 0);
>
> One thing I can't quite connect the dots on here, is what gets passed as the unused length when this is called from the table code?
Inside the hash table, the equals function is called from `lookup`, where the caller passes the length as a parameter. In our case, this is in `lookup_shared`:
https://github.com/openjdk/jdk/blob/4a78433cd33530186b7638a6aefd0e73ec50a3d5/src/hotspot/share/classfile/stringTable.cpp?plain=1#L904-L908
I added an explaining comment as to why 0 is passed instead of the actual length.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21325#discussion_r1838271037
PR Review Comment: https://git.openjdk.org/jdk/pull/21325#discussion_r1838269438
More information about the hotspot-dev
mailing list