8339640: Reduce construction overheads in StringConcatFactory$InlineHiddenClassStrategy
Reviewed-by: liach
This commit is contained in:
parent
260908e16e
commit
cb00333d6a
@ -1242,7 +1242,7 @@ public final class StringConcatFactory {
|
||||
lookup = STR_LOOKUP;
|
||||
final MethodType concatArgs = erasedArgs(args);
|
||||
|
||||
// 1 argment use built-in method
|
||||
// 1 argument use built-in method
|
||||
if (args.parameterCount() == 1) {
|
||||
Object concat1 = JLA.stringConcat1(constants);
|
||||
var handle = lookup.findVirtual(concat1.getClass(), METHOD_NAME, concatArgs);
|
||||
@ -1254,7 +1254,7 @@ public final class StringConcatFactory {
|
||||
MethodHandlePair handlePair = weakConstructorHandle.get();
|
||||
if (handlePair != null) {
|
||||
try {
|
||||
var instance = handlePair.constructor.invoke(constants);
|
||||
var instance = handlePair.constructor.invokeBasic((Object)constants);
|
||||
return handlePair.concatenator.bindTo(instance);
|
||||
} catch (Throwable e) {
|
||||
throw new StringConcatException("Exception while utilizing the hidden class", e);
|
||||
@ -1331,10 +1331,10 @@ public final class StringConcatFactory {
|
||||
var hiddenClass = lookup.makeHiddenClassDefiner(CLASS_NAME, classBytes, Set.of(), DUMPER)
|
||||
.defineClass(true, null);
|
||||
var constructor = lookup.findConstructor(hiddenClass, CONSTRUCTOR_METHOD_TYPE);
|
||||
var concat = lookup.findVirtual(hiddenClass, METHOD_NAME, concatArgs);
|
||||
CACHE.put(concatArgs, new SoftReference<>(new MethodHandlePair(constructor, concat)));
|
||||
var instance = hiddenClass.cast(constructor.invoke(constants));
|
||||
return concat.bindTo(instance);
|
||||
var concatenator = lookup.findVirtual(hiddenClass, METHOD_NAME, concatArgs);
|
||||
CACHE.put(concatArgs, new SoftReference<>(new MethodHandlePair(constructor, concatenator)));
|
||||
var instance = constructor.invokeBasic((Object)constants);
|
||||
return concatenator.bindTo(instance);
|
||||
} catch (Throwable e) {
|
||||
throw new StringConcatException("Exception while spinning the class", e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user