Proposal to remove StringConcatFactory#generateMHInlineCopy

Chen Liang chen.l.liang at oracle.com
Thu Sep 18 15:02:26 UTC 2025


I agree with the removal. If we need to restore it, we can always pull it from the git history, or just revert the removal commit.

Chen Liang
________________________________
From: core-libs-dev <core-libs-dev-retn at openjdk.org> on behalf of Claes Redestad <claes.redestad at oracle.com>
Sent: Thursday, September 18, 2025 8:55 AM
To: wenshao <shaojin.wensj at alibaba-inc.com>
Cc: core-libs-dev <core-libs-dev at openjdk.org>
Subject: Re: Proposal to remove StringConcatFactory#generateMHInlineCopy

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
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250918/965871ab/attachment.htm>


More information about the core-libs-dev mailing list