RFR: 8336856: Optimize String Concat [v35]

Claes Redestad redestad at openjdk.org
Wed Aug 7 00:07:36 UTC 2024


On Tue, 6 Aug 2024 23:41:09 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> This PR implements the same algorithm as the current generateMHInlineCopy based on bytecode to improve startup performance.
>
> Shaojin Wen has updated the pull request incrementally with six additional commits since the last revision:
> 
>  - checkOverflow
>  - highArity default 0
>  - use MethodTypeDesc instead of MethodType
>  - inlineThreshold parameter
>  - use more idiomatic class-file API
>  - rename SimpleStringBuilderStrategy to InlineHiddenClassStrategy

src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1584:

> 1582:                         }
> 1583:                         cb.iadd()
> 1584:                           .invokestatic(CD_StringConcatHelper, "checkOverflow", MTD_int_int);

Good, but wouldn't we generate slightly more compact code if this check was baked into the `stringSize` (when we call that) and only emitted in this generated for `char` parameters?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20273#discussion_r1706229674


More information about the core-libs-dev mailing list