W3cubDocs

/OpenJDK 21

Class AbstractRelinkableCallSite

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 the RelinkableCallSite as a MutableCallSite. It carries a CallSiteDescriptor passed in the constructor and provides the correct implementation of the initialize(MethodHandle) method. Subclasses must provide RelinkableCallSite.relink(GuardedInvocation, MethodHandle) and RelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle) methods.

Constructor Summary

Modifier Constructor Description
protected
Creates a new abstract relinkable call site.

Method Summary

Modifier and Type Method Description
CallSiteDescriptor getDescriptor()
Returns the descriptor for this call site.
void initialize(MethodHandle relinkAndInvoke)
Invoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle.

Methods declared in class java.lang.invoke.MutableCallSite

dynamicInvoker, getTarget, setTarget, syncAll

Methods declared in class java.lang.invoke.CallSite

type

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods declared in interface jdk.dynalink.RelinkableCallSite

relink, resetAndRelink

Constructor Details

AbstractRelinkableCallSite

protected AbstractRelinkableCallSite(CallSiteDescriptor descriptor)
Creates a new abstract relinkable call site.
Parameters:
descriptor - the descriptor for this call site that will be returned from getDescriptor(). The call site's CallSite.type() will be equal to descriptor's CallSiteDescriptor.getMethodType().
Throws:
NullPointerException - if descriptor is null.

Method Details

getDescriptor

public CallSiteDescriptor getDescriptor()
Description copied from interface: RelinkableCallSite
Returns the descriptor for this call site.
Specified by:
getDescriptor in interface RelinkableCallSite
Returns:
the descriptor for this call site.

initialize

public void initialize(MethodHandle relinkAndInvoke)
Description copied from interface: RelinkableCallSite
Invoked 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 using CallSite.setTarget(MethodHandle). Relink-and-invoke is the initial method handle set by DynamicLinker.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:
initialize in interface RelinkableCallSite
Parameters:
relinkAndInvoke - a relink-and-invoke method handle supplied by Dynalink.

© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.dynalink/jdk/dynalink/support/AbstractRelinkableCallSite.html