- java.lang.Object
-
- java.lang.invoke.CallSite
-
- java.lang.invoke.MutableCallSite
-
- jdk.dynalink.support.AbstractRelinkableCallSite
-
- All Implemented Interfaces:
RelinkableCallSite
- Direct Known Subclasses:
ChainedCallSite,SimpleRelinkableCallSite
public abstract class AbstractRelinkableCallSite extends MutableCallSite implements RelinkableCallSite
A basic implementation of theRelinkableCallSiteas aMutableCallSite. It carries aCallSiteDescriptorpassed in the constructor and provides the correct implementation of theinitialize(MethodHandle)method. Subclasses must provideRelinkableCallSite.relink(GuardedInvocation, MethodHandle)andRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)methods.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRelinkableCallSite(CallSiteDescriptor descriptor)Creates a new abstract relinkable call site.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CallSiteDescriptorgetDescriptor()Returns the descriptor for this call site.voidinitialize(MethodHandle relinkAndInvoke)Invoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle.-
Methods inherited from class java.lang.invoke.MutableCallSite
dynamicInvoker, getTarget, setTarget, syncAll
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jdk.dynalink.RelinkableCallSite
relink, resetAndRelink
-
-
-
-
Constructor Detail
-
AbstractRelinkableCallSite
protected AbstractRelinkableCallSite(CallSiteDescriptor descriptor)
Creates a new abstract relinkable call site.- Parameters:
descriptor- the descriptor for this call site that will be returned fromgetDescriptor(). The call site'sCallSite.type()will be equal to descriptor'sCallSiteDescriptor.getMethodType().- Throws:
NullPointerException- ifdescriptoris null.
-
-
Method Detail
-
getDescriptor
public CallSiteDescriptor getDescriptor()
Description copied from interface:RelinkableCallSiteReturns the descriptor for this call site.- Specified by:
getDescriptorin interfaceRelinkableCallSite- Returns:
- the descriptor for this call site.
-
initialize
public void initialize(MethodHandle relinkAndInvoke)
Description copied from interface:RelinkableCallSiteInvoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle. The call site implementation is supposed to set this method handle as its target usingCallSite.setTarget(MethodHandle). Relink-and-invoke is the initial method handle set byDynamicLinker.link(RelinkableCallSite)that will cause the call site to be relinked to an appropriate target on its first invocation based on its arguments, and that linked target will then be invoked (hence the name). This linking protocol effectively delays linking until the call site is invoked with actual arguments and thus ensures that linkers can make nuanced linking decisions based on those arguments and not just on the static method type of the call site.- Specified by:
initializein interfaceRelinkableCallSite- Parameters:
relinkAndInvoke- a relink-and-invoke method handle supplied by Dynalink.
-
-