8245094: Reduce overhead of initializing the default StringConcatFactory strategy

Reviewed-by: psandoz, jlaskey
This commit is contained in:
Claes Redestad 2020-05-15 18:37:08 +02:00
parent e83968799e
commit 150d6cfea8
3 changed files with 10 additions and 6 deletions

View File

@ -2283,6 +2283,10 @@ public final class System {
return StringConcatHelper.lookupStatic(name, methodType);
}
public long stringConcatInitialCoder() {
return StringConcatHelper.initialCoder();
}
public Object classData(Class<?> c) {
return c.getClassData();
}

View File

@ -1724,12 +1724,7 @@ public final class StringConcatFactory {
private static final long INITIAL_CODER;
static {
try {
MethodHandle initCoder = JLA.stringConcatHelper("initialCoder", methodType(long.class));
INITIAL_CODER = (long) initCoder.invoke();
} catch (Throwable e) {
throw new AssertionError(e);
}
INITIAL_CODER = JLA.stringConcatInitialCoder();
PREPENDERS = new ConcurrentHashMap<>();
MIXERS = new ConcurrentHashMap<>();

View File

@ -333,6 +333,11 @@ public interface JavaLangAccess {
*/
MethodHandle stringConcatHelper(String name, MethodType methodType);
/**
* Get the string concat initial coder
*/
long stringConcatInitialCoder();
/*
* Get the class data associated with the given class.
* @param c the class