RFR: 8338936: StringConcatFactory optimize the construction of MethodType and MethodTypeDesc
Shaojin Wen
duke at openjdk.org
Sun Aug 25 13:12:34 UTC 2024
On Sun, 25 Aug 2024 12:44:02 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1200:
>>
>>> 1198: /**
>>> 1199: * Construct the MethodType of the coder method, if there are no parameters it may be UTF16, return null.
>>> 1200: * The first parameter is the initialized coder, Only parameter types that can be UTF16 are added.
>>
>> Suggestion:
>>
>> * Construct the MethodType of the coder method. The first parameter is the initialized coder.
>> * Only parameter types which can be UTF16 are added. Returns null if no such parameter exists.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20704#discussion_r1730334070
More information about the core-libs-dev
mailing list