On Wed, 18 Oct 2023 11:56:14 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> In #16006 using `StringConcatFactory` seem to induce a run-to-run variance. > One idea to reduce this is to generate expression trees with fewer branches > by looking up and using the prefix-less `prepend` methods directly for cases > where constant is null/empty so that the prefixed prepender will always deal > with a non-null prefix constant. src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 725: > 723: } > 724: > 725: private static MethodHandle noPrefixPrepender(Class<?> cl) { Should the no-prefix prependers be declared package-private now that they are accessed via JLA? Otherwise we might accidentally change those APIs and break stuff. Another way to guard is to make stringConcatHelper find methods with a lookup restricted to package access by changing this line: https://github.com/openjdk/jdk/blob/e25a49a993f270c33f7929e629fb3075a11fdec9/src/java.base/share/classes/java/lang/StringConcatHelper.java#L589 to return MethodHandles.lookup() .dropLookupMode(MethodHandles.Lookup.PRIVATE) .findStatic(StringConcatHelper.class, name, methodType); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16244#discussion_r1364794177