public interface RelinkableCallSite
CallSite
that also implement this interface as their call sites. There is a readily usable
MonomorphicCallSite
subclass that implements monomorphic inline caching strategy as well as a
ChainedCallSite
that retains a chain of already linked method handles. The reason this is defined as an
interface instead of a concrete, albeit abstract class is that it allows independent implementations to choose
between MutableCallSite
and VolatileCallSite
as they see fit.Modifier and Type | Method and Description |
---|---|
CallSiteDescriptor |
getDescriptor()
Returns the descriptor for this call site.
|
void |
initialize(MethodHandle relinkAndInvoke)
Initializes the relinkable call site by setting a relink-and-invoke method handle.
|
void |
relink(GuardedInvocation guardedInvocation,
MethodHandle fallback)
This method will be called by the dynamic linker every time the call site is normally relinked.
|
void |
resetAndRelink(GuardedInvocation guardedInvocation,
MethodHandle fallback)
This method will be called by the dynamic linker every time the call site is relinked and the linker wishes the
call site to throw away any prior linkage state.
|
void initialize(MethodHandle relinkAndInvoke)
relinkAndInvoke
- a relink-and-invoke method handle supplied by the DynamicLinker
.CallSiteDescriptor getDescriptor()
void relink(GuardedInvocation guardedInvocation, MethodHandle fallback)
GuardedInvocation
that the call site should incorporate into its target method handle. When this method
is called, the call site is allowed to keep other non-invalidated invocations around for implementation of
polymorphic inline caches and compose them with this invocation to form its final target.guardedInvocation
- the guarded invocation that the call site should incorporate into its target method
handle.fallback
- the fallback method. This is a method matching the method type of the call site that is supplied
by the DynamicLinker
to be used by this call site as a fallback when it can't invoke its target with the
passed arguments. The fallback method is such that when it's invoked, it'll try to discover the adequate target
for the invocation, subsequently invoke relink(GuardedInvocation, MethodHandle)
or
resetAndRelink(GuardedInvocation, MethodHandle)
, and finally invoke the target.void resetAndRelink(GuardedInvocation guardedInvocation, MethodHandle fallback)
GuardedInvocation
that the call site
should use to build its target method handle. When this method is called, the call site is discouraged from
keeping previous state around, and is supposed to only link the current invocation.guardedInvocation
- the guarded invocation that the call site should use to build its target method handle.fallback
- the fallback method. This is a method matching the method type of the call site that is supplied
by the DynamicLinker
to be used by this call site as a fallback when it can't invoke its target with the
passed arguments. The fallback method is such that when it's invoked, it'll try to discover the adequate target
for the invocation, subsequently invoke relink(GuardedInvocation, MethodHandle)
or
resetAndRelink(GuardedInvocation, MethodHandle)
, and finally invoke the target.Copyright © 2016 Attila Szegedi. All rights reserved.