Top Description Inners Fields Constructors Methods
java.lang.invoke

pack-priv Class Invokers

extends Object
Class Inheritance
Imports
jdk.internal.vm.annotation.DontInline, .ForceInline, .Hidden, .Stable, java.util.Arrays

Construction and caching of often-used invokers.
Author
jrose

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
private static class

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
private final MethodHandle[]
private static final int
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final LambdaForm.NamedFunction[]
private final MethodType
pack-priv static final int
pack-priv static final int

Constructor Summary

AccessConstructor and Description
pack-priv
Invokers(MethodType targetType)

Compute and cache information common to all collecting adapters that implement members of the erasure-family of the given erased type.

Method Summary

Modifier and TypeMethod and Description
pack-priv MethodHandle
private MethodHandle
cachedInvoker(int idx)

private MethodHandle
cachedVHInvoker(boolean isExact, VarHandle.AccessMode ak)

pack-priv static LambdaForm
callSiteForm(MethodType mtype, boolean skipCallSite)

pack-priv static void
pack-priv static void
checkExactType(MethodHandle mh, MethodType expected)

Static definition of MethodHandle.invokeExact checking code.

pack-priv static MethodHandle
checkGenericType(MethodHandle mh, MethodType expected)

Static definition of MethodHandle.invokeGeneric checking code.

private boolean
pack-priv static MethodHandle
pack-priv static MethodHandle
private boolean
private static LambdaForm.NamedFunction
createFunction(byte func)

pack-priv static VarHandle
pack-priv MethodHandle
pack-priv MethodHandle
pack-priv static MethodHandle
getCallSiteTarget(CallSite site)

Static definition of MethodHandle.invokeGeneric checking code.

private static LambdaForm.NamedFunction
getFunction(byte func)

private static LambdaForm.NamedFunction
private static Class<?>
impliedRestargType(MethodType restargType, int fromPos)

pack-priv static MemberName
pack-priv static LambdaForm
invokeHandleForm(MethodType
the caller's method type (either basic or full-custom)
mtype
,
boolean
whether to use a trailing appendix argument (to carry the mtype)
customized
,
int
bit-encoded 0x01 whether it is a CP adapter ("linker") or MHs.invoker value ("invoker"); 0x02 whether it is for invokeExact or generic invoke
which
)

Returns an adapter for invokeExact or generic invoke, as a MH or constant pool linker.

pack-priv static MemberName
pack-priv static MemberName
private MethodHandle
makeExactOrGeneralInvoker(boolean isExact)

private MethodHandle
private void
maybeCompileToBytecode(MethodHandle invoker)

If the target type seems to be common enough, eagerly compile the invoker to bytecodes.

pack-priv static void
pack-priv static MemberName
methodHandleInvokeLinkerMethod(String name, MethodType mtype, Object[] appendixResult)

pack-priv static WrongMethodTypeException
private synchronized MethodHandle
setCachedInvoker(int idx, final MethodHandle invoker)

private MethodHandle
setCachedVHInvoker(boolean isExact, VarHandle.AccessMode ak, final MethodHandle invoker)

pack-priv MethodHandle

Returns:

invoker.invokeExact(mh, uarg*, C[]{sarg*}) := (RT)mh.invoke(uarg*, sarg*)
spreadInvoker
(int
the number of unchanged (non-spread) arguments
leadingArgCount
)

Find or create an invoker which passes unchanged a given number of arguments and spreads the rest from a trailing array argument.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv static MemberName
pack-priv MethodHandle
private static LambdaForm
pack-priv MethodHandle
private static LambdaForm
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

INV_BASICback to summary
pack-priv static final int INV_BASIC
INV_EXACTback to summary
pack-priv static final int INV_EXACT
INV_GENERICback to summary
pack-priv static final int INV_GENERIC
INV_LIMITback to summary
pack-priv static final int INV_LIMIT
invokersback to summary
private final MethodHandle[] invokers
Annotations
@Stable
MH_LINKER_ARG_APPENDEDback to summary
private static final int MH_LINKER_ARG_APPENDED
NF_checkCustomizedback to summary
private static final byte NF_checkCustomized
NF_checkExactTypeback to summary
private static final byte NF_checkExactType
NF_checkGenericTypeback to summary
private static final byte NF_checkGenericType
NF_checkVarHandleExactTypeback to summary
private static final byte NF_checkVarHandleExactType
NF_checkVarHandleGenericTypeback to summary
private static final byte NF_checkVarHandleGenericType
NF_directVarHandleTargetback to summary
private static final byte NF_directVarHandleTarget
NF_getCallSiteTargetback to summary
private static final byte NF_getCallSiteTarget
NF_LIMITback to summary
private static final byte NF_LIMIT
NFSback to summary
private static final LambdaForm.NamedFunction[] NFS
Annotations
@Stable
targetTypeback to summary
private final MethodType targetType
VH_INV_EXACTback to summary
pack-priv static final int VH_INV_EXACT
VH_INV_GENERICback to summary
pack-priv static final int VH_INV_GENERIC

Constructor Detail

Invokersback to summary
pack-priv Invokers(MethodType targetType)

Compute and cache information common to all collecting adapters that implement members of the erasure-family of the given erased type.

Method Detail

basicInvokerback to summary
pack-priv MethodHandle basicInvoker()
cachedInvokerback to summary
private MethodHandle cachedInvoker(int idx)
cachedVHInvokerback to summary
private MethodHandle cachedVHInvoker(boolean isExact, VarHandle.AccessMode ak)
callSiteFormback to summary
pack-priv static LambdaForm callSiteForm(MethodType mtype, boolean skipCallSite)
checkCustomizedback to summary
pack-priv static void checkCustomized(MethodHandle mh)
Annotations
@ForceInline
checkExactTypeback to summary
pack-priv static void checkExactType(MethodHandle mh, MethodType expected)

Static definition of MethodHandle.invokeExact checking code.

Annotations
@ForceInline
checkGenericTypeback to summary
pack-priv static MethodHandle checkGenericType(MethodHandle mh, MethodType expected)

Static definition of MethodHandle.invokeGeneric checking code. Directly returns the type-adjusted MH to invoke, as follows: (R)MH.invoke(a*) => MH.asType(TYPEOF(a*:R)).invokeBasic(a*)

Annotations
@ForceInline
checkInvokerback to summary
private boolean checkInvoker(MethodHandle invoker)
checkVarHandleExactTypeback to summary
pack-priv static MethodHandle checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad)
Annotations
@ForceInline
checkVarHandleGenericTypeback to summary
pack-priv static MethodHandle checkVarHandleGenericType(VarHandle handle, VarHandle.AccessDescriptor ad)
Annotations
@ForceInline
@Hidden
checkVarHandleInvokerback to summary
private boolean checkVarHandleInvoker(MethodHandle invoker)
createFunctionback to summary
private static LambdaForm.NamedFunction createFunction(byte func)
directVarHandleTargetback to summary
pack-priv static VarHandle directVarHandleTarget(VarHandle handle)
Annotations
@ForceInline
exactInvokerback to summary
pack-priv MethodHandle exactInvoker()
genericInvokerback to summary
pack-priv MethodHandle genericInvoker()
getCallSiteTargetback to summary
pack-priv static MethodHandle getCallSiteTarget(CallSite site)

Static definition of MethodHandle.invokeGeneric checking code.

Annotations
@ForceInline
getFunctionback to summary
private static LambdaForm.NamedFunction getFunction(byte func)
getNamedFunctionback to summary
private static LambdaForm.NamedFunction getNamedFunction(String name, MethodType type) throws ReflectiveOperationException
impliedRestargTypeback to summary
private static Class<?> impliedRestargType(MethodType restargType, int fromPos)
invokeBasicMethodback to summary
pack-priv static MemberName invokeBasicMethod(MethodType basicType)
invokeHandleFormback to summary
pack-priv static LambdaForm invokeHandleForm(MethodType mtype, boolean customized, int which)

Returns an adapter for invokeExact or generic invoke, as a MH or constant pool linker. If !customized, caller is responsible for supplying, during adapter execution, a copy of the exact mtype. This is because the adapter might be generalized to a basic type.

Parameters
mtype:MethodType

the caller's method type (either basic or full-custom)

customized:boolean

whether to use a trailing appendix argument (to carry the mtype)

which:int

bit-encoded 0x01 whether it is a CP adapter ("linker") or MHs.invoker value ("invoker"); 0x02 whether it is for invokeExact or generic invoke

linkToCallSiteMethodback to summary
pack-priv static MemberName linkToCallSiteMethod(MethodType mtype)
linkToTargetMethodback to summary
pack-priv static MemberName linkToTargetMethod(MethodType mtype)
makeExactOrGeneralInvokerback to summary
private MethodHandle makeExactOrGeneralInvoker(boolean isExact)
makeVarHandleMethodInvokerback to summary
private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak, boolean isExact)
maybeCompileToBytecodeback to summary
private void maybeCompileToBytecode(MethodHandle invoker)

If the target type seems to be common enough, eagerly compile the invoker to bytecodes.

maybeCustomizeback to summary
pack-priv static void maybeCustomize(MethodHandle mh)
Annotations
@DontInline
methodHandleInvokeLinkerMethodback to summary
pack-priv static MemberName methodHandleInvokeLinkerMethod(String name, MethodType mtype, Object[] appendixResult)
newWrongMethodTypeExceptionback to summary
pack-priv static WrongMethodTypeException newWrongMethodTypeException(MethodType targetType, MethodType callSiteType)
setCachedInvokerback to summary
private synchronized MethodHandle setCachedInvoker(int idx, final MethodHandle invoker)
setCachedVHInvokerback to summary
private MethodHandle setCachedVHInvoker(boolean isExact, VarHandle.AccessMode ak, final MethodHandle invoker)
spreadInvokerback to summary
pack-priv MethodHandle spreadInvoker(int leadingArgCount)

Find or create an invoker which passes unchanged a given number of arguments and spreads the rest from a trailing array argument. The invoker target type is the post-spread type (TYPEOF(uarg*), TYPEOF(sarg*))=>RT. All the sargs must have a common type C. (If there are none, Object is assumed.}

Parameters
leadingArgCount:int

the number of unchanged (non-spread) arguments

Returns:MethodHandle

invoker.invokeExact(mh, uarg*, C[]{sarg*}) := (RT)mh.invoke(uarg*, sarg*)

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

varHandleInvokeLinkerMethodback to summary
pack-priv static MemberName varHandleInvokeLinkerMethod(MethodType mtype)
varHandleMethodExactInvokerback to summary
pack-priv MethodHandle varHandleMethodExactInvoker(VarHandle.AccessMode ak)
varHandleMethodGenericLinkerHandleFormback to summary
private static LambdaForm varHandleMethodGenericLinkerHandleForm(MethodType mtype)
varHandleMethodInvokerback to summary
pack-priv MethodHandle varHandleMethodInvoker(VarHandle.AccessMode ak)
varHandleMethodInvokerHandleFormback to summary
private static LambdaForm varHandleMethodInvokerHandleForm(MethodType mtype, boolean isExact)
java.lang.invoke back to summary

pack-priv final Class Invokers.Holder

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Holderback to summary
pack-priv Holder()
java.lang.invoke back to summary

private Class Invokers.Lazy

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final MethodHandle

Constructor Summary

AccessConstructor and Description
private
Lazy()

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MH_asSpreaderback to summary
private static final MethodHandle MH_asSpreader

Constructor Detail

Lazyback to summary
private Lazy()