src/share/classes/java/lang/invoke/LambdaForm.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
jdk Cdiff src/share/classes/java/lang/invoke/LambdaForm.java
src/share/classes/java/lang/invoke/LambdaForm.java
Print this page
rev 10271 : 8037209: Improvements and cleanups to bytecode assembly for lambda forms
Reviewed-by: vlivanov, psandoz
Contributed-by: john.r.rose@oracle.com
rev 10274 : 8050052: Small cleanups in java.lang.invoke code
Reviewed-by: ?
rev 10275 : imported patch invokers
*** 1145,1155 ****
int arity = LambdaForm.signatureArity(sig);
MethodType srcType = MethodType.genericMethodType(arity);
if (LambdaForm.signatureReturn(sig) == V_TYPE)
srcType = srcType.changeReturnType(void.class);
MethodTypeForm typeForm = srcType.form();
! typeForm.namedFunctionInvoker = DirectMethodHandle.make(m);
}
}
}
// The following are predefined NamedFunction invokers. The system must build
--- 1145,1155 ----
int arity = LambdaForm.signatureArity(sig);
MethodType srcType = MethodType.genericMethodType(arity);
if (LambdaForm.signatureReturn(sig) == V_TYPE)
srcType = srcType.changeReturnType(void.class);
MethodTypeForm typeForm = srcType.form();
! typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, DirectMethodHandle.make(m));
}
}
}
// The following are predefined NamedFunction invokers. The system must build
*** 1243,1261 ****
static final MethodType INVOKER_METHOD_TYPE =
MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
! MethodHandle mh = typeForm.namedFunctionInvoker;
if (mh != null) return mh;
MemberName invoker = InvokerBytecodeGenerator.generateNamedFunctionInvoker(typeForm); // this could take a while
mh = DirectMethodHandle.make(invoker);
! MethodHandle mh2 = typeForm.namedFunctionInvoker;
if (mh2 != null) return mh2; // benign race
if (!mh.type().equals(INVOKER_METHOD_TYPE))
throw newInternalError(mh.debugString());
! return typeForm.namedFunctionInvoker = mh;
}
@Hidden
Object invokeWithArguments(Object... arguments) throws Throwable {
// If we have a cached invoker, call it right away.
--- 1243,1262 ----
static final MethodType INVOKER_METHOD_TYPE =
MethodType.methodType(Object.class, MethodHandle.class, Object[].class);
private static MethodHandle computeInvoker(MethodTypeForm typeForm) {
! typeForm = typeForm.basicType().form(); // normalize to basic type
! MethodHandle mh = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
if (mh != null) return mh;
MemberName invoker = InvokerBytecodeGenerator.generateNamedFunctionInvoker(typeForm); // this could take a while
mh = DirectMethodHandle.make(invoker);
! MethodHandle mh2 = typeForm.cachedMethodHandle(MethodTypeForm.MH_NF_INV);
if (mh2 != null) return mh2; // benign race
if (!mh.type().equals(INVOKER_METHOD_TYPE))
throw newInternalError(mh.debugString());
! return typeForm.setCachedMethodHandle(MethodTypeForm.MH_NF_INV, mh);
}
@Hidden
Object invokeWithArguments(Object... arguments) throws Throwable {
// If we have a cached invoker, call it right away.
src/share/classes/java/lang/invoke/LambdaForm.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File