Class SimpleRelinkableCallSite
java.lang.Object
java.lang.invoke.CallSite
java.lang.invoke.MutableCallSite
jdk.dynalink.support.AbstractRelinkableCallSite
jdk.dynalink.support.SimpleRelinkableCallSite
- All Implemented Interfaces:
RelinkableCallSite
public class SimpleRelinkableCallSite extends AbstractRelinkableCallSite
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.- Since:
- 9
Constructor Summary
| Constructor | Description |
|---|---|
SimpleRelinkableCallSite |
Creates a new call site with monomorphic inline caching strategy. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
void |
relink |
This method will be called by the dynamic linker every time the call site is relinked (but see RelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle) for an exception). |
void |
resetAndRelink |
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 from RelinkableCallSite.relink(GuardedInvocation, MethodHandle)). |
Methods declared in class AbstractRelinkableCallSite
getDescriptor, initialize | Modifier and Type | Method | Description |
|---|---|---|
CallSiteDescriptor |
getDescriptor() |
Returns the descriptor for this call site. |
void |
initialize |
Invoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle. |
Methods declared in class MutableCallSite
dynamicInvoker, getTarget, setTarget, syncAll | Modifier and Type | Method | Description |
|---|---|---|
final MethodHandle |
dynamicInvoker() |
Produces a method handle equivalent to an invokedynamic instruction which has been linked to this call site. |
final MethodHandle |
getTarget() |
Returns the target method of the call site, which behaves like a normal field of the MutableCallSite. |
void |
setTarget |
Updates the target method of this call site, as a normal variable. |
static void |
syncAll |
Performs a synchronization operation on each call site in the given array, forcing all other threads to throw away any cached values previously loaded from the target of any of the call sites. |
Methods declared in class CallSite
type | Modifier and Type | Method | Description |
|---|---|---|
MethodType |
type() |
Returns the type of this call site's target. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
SimpleRelinkableCallSite
public SimpleRelinkableCallSite(CallSiteDescriptor descriptor)
Creates a new call site with monomorphic inline caching strategy.
- Parameters:
-
descriptor- the descriptor for this call site
Method Details
relink
public void relink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke)
Description copied from interface:
RelinkableCallSiteThis method will be called by the dynamic linker every time the call site is relinked (but see
RelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle) for an exception). It will be passed a 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.- 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 theDynamicLinkeras 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 targetGuardedInvocationfor the invocation, and subsequently invokeRelinkableCallSite.relink(GuardedInvocation, MethodHandle)orRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle), and finally invoke the target.
resetAndRelink
public void resetAndRelink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke)
Description copied from interface:
RelinkableCallSiteThis 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 from
RelinkableCallSite.relink(GuardedInvocation, MethodHandle)). It will be passed a GuardedInvocation 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 theDynamicLinkeras 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 targetGuardedInvocationfor the invocation, and subsequently invokeRelinkableCallSite.relink(GuardedInvocation, MethodHandle)orRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle), and finally invoke the target.
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.