Proposal to remove StringConcatFactory#generateMHInlineCopy
Claes Redestad
claes.redestad at oracle.com
Thu Sep 18 13:55:11 UTC 2025
Hi,
I think it was https://bugs.openjdk.org/browse/JDK-8336856 which made the old generateMHInline non-default / opt-in.
But yes, I’ve planned proposing a removal of this for JDK 26. If you want to file an RFE and work out a PR I’d be happy to approve, otherwise it’s on my to-do list.
Thanks!
Claes
> 17 sep. 2025 kl. 03:13 skrev wenshao <shaojin.wensj at alibaba-inc.com>:
>
> With the introduction of 8338930: StringConcatFactory hardCoded string concatenation strategy, the StringConcatFactory#generateMHInlineCopy method is no longer used by default.
>
> ```java
> public final class StringConcatFactory {
> private static final int HIGH_ARITY_THRESHOLD;
> static {
> String highArity = VM.getSavedProperty("java.lang.invoke.StringConcat.highArityThreshold");
> HIGH_ARITY_THRESHOLD = highArity != null ? Integer.parseInt(highArity) : 0;
> }
> public static CallSite makeConcatWithConstants(MethodHandles.Lookup lookup,
> String name,
> MethodType concatType,
> String recipe,
> Object... constants)
> throws StringConcatException
> {
> MethodHandle mh = makeSimpleConcat(concatType, constantStrings);
> if (mh == null && concatType.parameterCount() <= HIGH_ARITY_THRESHOLD) {
> mh = generateMHInlineCopy(concatType, constantStrings); // no longer used by default.
> }
> }
> }
> ```
>
> After a year of community use, the InlineHiddenClassStrategy has proven to work well, so I recommend removing the implementation of StringConcatFactory#generateMHInlineCopy.
>
> -
> Shaojin Wen
>
More information about the core-libs-dev
mailing list