RFR: 8338936: StringConcatFactory optimize the construction of MethodType and MethodTypeDesc

Claes Redestad redestad at openjdk.org
Sun Aug 25 13:12:33 UTC 2024


On Sun, 25 Aug 2024 12:35:00 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> optimize the construction of MethodType and MethodTypeDesc to reduce memory allocate
>
> 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.

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

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


More information about the core-libs-dev mailing list