RFR: 8327156: Avoid copying in StringTable::intern(oop, TRAPS) [v6]
Casper Norrbin
cnorrbin at openjdk.org
Tue Nov 12 15:34:32 UTC 2024
On Mon, 11 Nov 2024 21:50:58 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/javaClasses.cpp line 393:
>
>> 391: #ifdef ASSERT
>> 392: // This check is too strict on older classfile versions
>> 393: if (UTF8::is_legal_utf8((const unsigned char*)utf8_str, utf8_len, /*version_leq_47*/false))
>
> I don't see the point of this check. Any validation would/should be done when the Symbol is created, not when it is later used.
The problem is that the string could technically be correct according to its classfile version, but could then fail the checks done here. The older classfile versions had relaxed requirements, and these don't play well the checks here.
So when the Symbol is created the string is not technically "wrong", it's just that some functions (like here) assume that the string is correct according to newer definitions of "correct". It is not certain that the checks of these strings would succeed, we can only guarantee that on newer "correct" UTF8.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21325#discussion_r1838311131
More information about the hotspot-dev
mailing list