mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8199471: Enable generation of callSiteForms at link time
Reviewed-by: psandoz, mchung
This commit is contained in:
parent
562b3c4393
commit
b66ffad152
6 changed files with 77 additions and 24 deletions
|
@ -133,7 +133,7 @@ class GenerateJLIClassesHelper {
|
|||
}
|
||||
|
||||
static byte[] generateInvokersHolderClassBytes(String className,
|
||||
MethodType[] methodTypes) {
|
||||
MethodType[] invokerMethodTypes, MethodType[] callSiteMethodTypes) {
|
||||
|
||||
HashSet<MethodType> dedupSet = new HashSet<>();
|
||||
ArrayList<LambdaForm> forms = new ArrayList<>();
|
||||
|
@ -144,17 +144,33 @@ class GenerateJLIClassesHelper {
|
|||
MethodTypeForm.LF_GEN_LINKER,
|
||||
MethodTypeForm.LF_GEN_INVOKER
|
||||
};
|
||||
for (int i = 0; i < methodTypes.length; i++) {
|
||||
|
||||
for (int i = 0; i < invokerMethodTypes.length; i++) {
|
||||
// generate methods representing invokers of the specified type
|
||||
if (dedupSet.add(methodTypes[i])) {
|
||||
if (dedupSet.add(invokerMethodTypes[i])) {
|
||||
for (int type : types) {
|
||||
LambdaForm invokerForm = Invokers.invokeHandleForm(methodTypes[i],
|
||||
LambdaForm invokerForm = Invokers.invokeHandleForm(invokerMethodTypes[i],
|
||||
/*customized*/false, type);
|
||||
forms.add(invokerForm);
|
||||
names.add(invokerForm.kind.defaultLambdaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dedupSet = new HashSet<>();
|
||||
for (int i = 0; i < callSiteMethodTypes.length; i++) {
|
||||
// generate methods representing invokers of the specified type
|
||||
if (dedupSet.add(callSiteMethodTypes[i])) {
|
||||
LambdaForm callSiteForm = Invokers.callSiteForm(callSiteMethodTypes[i], true);
|
||||
forms.add(callSiteForm);
|
||||
names.add(callSiteForm.kind.defaultLambdaName);
|
||||
|
||||
LambdaForm methodHandleForm = Invokers.callSiteForm(callSiteMethodTypes[i], false);
|
||||
forms.add(methodHandleForm);
|
||||
names.add(methodHandleForm.kind.defaultLambdaName);
|
||||
}
|
||||
}
|
||||
|
||||
return generateCodeBytesForLFs(className,
|
||||
names.toArray(new String[0]),
|
||||
forms.toArray(new LambdaForm[0]));
|
||||
|
|
|
@ -649,6 +649,8 @@ class InvokerBytecodeGenerator {
|
|||
}
|
||||
case EXACT_INVOKER: // fall-through
|
||||
case EXACT_LINKER: // fall-through
|
||||
case LINK_TO_CALL_SITE: // fall-through
|
||||
case LINK_TO_TARGET_METHOD: // fall-through
|
||||
case GENERIC_INVOKER: // fall-through
|
||||
case GENERIC_LINKER: return resolveFrom(name, invokerType.basicType(), Invokers.Holder.class);
|
||||
case GET_OBJECT: // fall-through
|
||||
|
|
|
@ -523,7 +523,7 @@ class Invokers {
|
|||
}
|
||||
|
||||
// skipCallSite is true if we are optimizing a ConstantCallSite
|
||||
private static LambdaForm callSiteForm(MethodType mtype, boolean skipCallSite) {
|
||||
static LambdaForm callSiteForm(MethodType mtype, boolean skipCallSite) {
|
||||
mtype = mtype.basicType(); // normalize Z to I, String to Object, etc.
|
||||
final int which = (skipCallSite ? MethodTypeForm.LF_MH_LINKER : MethodTypeForm.LF_CS_LINKER);
|
||||
LambdaForm lform = mtype.form().cachedLambdaForm(which);
|
||||
|
|
|
@ -1841,10 +1841,13 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
|||
|
||||
@Override
|
||||
public byte[] generateInvokersHolderClassBytes(final String className,
|
||||
MethodType[] methodTypes) {
|
||||
MethodType[] invokerMethodTypes,
|
||||
MethodType[] callSiteMethodTypes) {
|
||||
return GenerateJLIClassesHelper
|
||||
.generateInvokersHolderClassBytes(className, methodTypes);
|
||||
.generateInvokersHolderClassBytes(className,
|
||||
invokerMethodTypes, callSiteMethodTypes);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue