Proposal to remove StringConcatFactory#generateMHInlineCopy
wenshao
shaojin.wensj at alibaba-inc.com
Wed Sep 17 01:13:24 UTC 2025
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/20250917/f45c2f2e/attachment-0001.htm>
More information about the core-libs-dev
mailing list