On Sun, 25 Aug 2024 13:03:23 GMT, Shaojin Wen <d...@openjdk.org> wrote:

>> Something to consider (for a follow up) is to not add the initial coder as 
>> an argument but test that in the outer method: No point calling the `coder` 
>> method if we already know that we're UTF-16.
>
> If initCoder is UTF16, the coder method does not need to be generated. This 
> is an optimization and may be a separate PR. Of course, if you agree, I can 
> also put it here.

Right, if `initCoder` is always UTF16 (`-XX:-CompactStrings`) then we never 
need the `coder` method. Nor really if any of the constants have UTF-16 chars, 
but in those cases it might be more appropriate to inject the derived value and 
have a runtime test - as long as it get optimized away. Otherwise we might need 
to generate two different classes per shape.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20704#discussion_r1730342058

Reply via email to