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.
Since:
9
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new abstract relinkable call site.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 MutableCallSite

    dynamicInvoker, getTarget, setTarget, syncAll
    Modifier and Type
    Method
    Description
    Produces a method handle equivalent to an invokedynamic instruction which has been linked to this call site.
    Returns the target method of the call site, which behaves like a normal field of the MutableCallSite.
    void
    Updates the target method of this call site, as a normal variable.
    static void
    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
    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
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.

    Methods declared in interface RelinkableCallSite

    relink, resetAndRelink
    Modifier and Type
    Method
    Description
    void
    relink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke)
    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(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 from RelinkableCallSite.relink(GuardedInvocation, MethodHandle)).
  • Constructor Details

  • 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.