java.lang.Object
java.lang.invoke.CallSite
java.lang.invoke.MutableCallSite
jdk.dynalink.support.AbstractRelinkableCallSite
jdk.dynalink.support.SimpleRelinkableCallSite
- All Implemented Interfaces:
RelinkableCallSite
A relinkable call site that implements monomorphic inline caching strategy,
only being linked to a single
GuardedInvocation
at any given time.
If the guard of that single invocation fails, or it has an invalidated
switch point, or its invalidating exception triggered, then the call site
will throw it away and ask its associated DynamicLinker
to relink it.-
Constructor Summary
ConstructorDescriptionSimpleRelinkableCallSite
(CallSiteDescriptor descriptor) Creates a new call site with monomorphic inline caching strategy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
relink
(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke) This method will be called by the dynamic linker every time the call site is relinked (but seeRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)
for an exception).void
resetAndRelink
(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke) 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 (that is how it differs fromRelinkableCallSite.relink(GuardedInvocation, MethodHandle)
).Methods declared in class jdk.dynalink.support.AbstractRelinkableCallSite
getDescriptor, initialize
Methods declared in class java.lang.invoke.MutableCallSite
dynamicInvoker, getTarget, setTarget, syncAll
-
Constructor Details
-
SimpleRelinkableCallSite
Creates a new call site with monomorphic inline caching strategy.- Parameters:
descriptor
- the descriptor for this call site
-
-
Method Details
-
relink
Description copied from interface:RelinkableCallSite
This method will be called by the dynamic linker every time the call site is relinked (but seeRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)
for an exception). It will be passed aGuardedInvocation
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.- Parameters:
guardedInvocation
- the guarded invocation that the call site should incorporate into its target method handle.relinkAndInvoke
- a relink-and-invoke method handle. This is a method handle matching the method type of the call site that is supplied by theDynamicLinker
as a callback. It should be used by this call site as the ultimate 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 obtain an adequate targetGuardedInvocation
for the invocation, and subsequently invokeRelinkableCallSite.relink(GuardedInvocation, MethodHandle)
orRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)
, and finally invoke the target.
-
resetAndRelink
Description copied from interface:RelinkableCallSite
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 (that is how it differs fromRelinkableCallSite.relink(GuardedInvocation, MethodHandle)
). It will be passed aGuardedInvocation
that the call site should use to build its new target method handle. When this method is called, the call site is discouraged from keeping any previous state, and is supposed to only link the current invocation.- Parameters:
guardedInvocation
- the guarded invocation that the call site should use to build its target method handle.relinkAndInvoke
- a relink-and-invoke method handle. This is a method handle matching the method type of the call site that is supplied by theDynamicLinker
as a callback. It should be used by this call site as the ultimate 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 obtain an adequate targetGuardedInvocation
for the invocation, and subsequently invokeRelinkableCallSite.relink(GuardedInvocation, MethodHandle)
orRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)
, and finally invoke the target.
-