8298590: Refactor LambdaForm constructors

Reviewed-by: redestad
This commit is contained in:
Jorn Vernee 2023-01-02 12:06:26 +00:00
parent d812022890
commit 0532045edb
8 changed files with 88 additions and 69 deletions

View file

@ -836,7 +836,7 @@ abstract class MethodHandleImpl {
invokeArgs[0] = names[SELECT_ALT];
names[CALL_TARGET] = new Name(basicType, invokeArgs);
lform = new LambdaForm(lambdaType.parameterCount(), names, /*forceInline=*/true, Kind.GUARD);
lform = LambdaForm.create(lambdaType.parameterCount(), names, /*forceInline=*/true, Kind.GUARD);
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWT, lform);
}
@ -912,7 +912,7 @@ abstract class MethodHandleImpl {
Object[] unboxArgs = new Object[] {names[GET_UNBOX_RESULT], names[TRY_CATCH]};
names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
lform = new LambdaForm(lambdaType.parameterCount(), names, Kind.GUARD_WITH_CATCH);
lform = LambdaForm.create(lambdaType.parameterCount(), names, Kind.GUARD_WITH_CATCH);
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
}
@ -1798,7 +1798,7 @@ abstract class MethodHandleImpl {
names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
lform = basicType.form().setCachedLambdaForm(MethodTypeForm.LF_LOOP,
new LambdaForm(lambdaType.parameterCount(), names, Kind.LOOP));
LambdaForm.create(lambdaType.parameterCount(), names, Kind.LOOP));
}
// BOXED_ARGS is the index into the names array where the loop idiom starts
@ -2032,7 +2032,7 @@ abstract class MethodHandleImpl {
Object[] unboxArgs = new Object[] {names[GET_UNBOX_RESULT], names[TRY_FINALLY]};
names[UNBOX_RESULT] = new Name(invokeBasicUnbox, unboxArgs);
lform = new LambdaForm(lambdaType.parameterCount(), names, Kind.TRY_FINALLY);
lform = LambdaForm.create(lambdaType.parameterCount(), names, Kind.TRY_FINALLY);
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_TF, lform);
}
@ -2127,7 +2127,7 @@ abstract class MethodHandleImpl {
names[CALL_NEW_ARRAY], storeIndex, names[argCursor]);
}
LambdaForm lform = new LambdaForm(lambdaType.parameterCount(), names, CALL_NEW_ARRAY, Kind.COLLECTOR);
LambdaForm lform = LambdaForm.create(lambdaType.parameterCount(), names, CALL_NEW_ARRAY, Kind.COLLECTOR);
if (isSharedLambdaForm) {
lform = basicType.form().setCachedLambdaForm(MethodTypeForm.LF_COLLECTOR, lform);
}
@ -2252,7 +2252,7 @@ abstract class MethodHandleImpl {
names[UNBOXED_RESULT] = new Name(invokeBasic, unboxArgs);
}
lform = new LambdaForm(lambdaType.parameterCount(), names, Kind.TABLE_SWITCH);
lform = LambdaForm.create(lambdaType.parameterCount(), names, Kind.TABLE_SWITCH);
LambdaForm prev = TableSwitchCacheKey.CACHE.putIfAbsent(key, lform);
return prev != null ? prev : lform;
}