Class ChainedCallSite

All Implemented Interfaces:
RelinkableCallSite
public class ChainedCallSite
extends AbstractRelinkableCallSite

A relinkable call site that implements a polymorphic inline caching strategy. It remembers up to 8 GuardedInvocations it was linked with, and on each relink request builds a cascading chain of method handles of one invocation falling back to the next one. The number of remembered invocations can be customized by overriding getMaxChainLength() in a subclass. When this call site is relinked with a new invocation and the length of the chain is already at the maximum, it will throw away the oldest invocation. Invocations with invalidated switch points and ones for which their invalidating exception triggered are removed eagerly from the chain. The invocations are never reordered; the most recently linked method handle is always at the start of the chain and the least recently linked at its end. The call site can be safely relinked on more than one thread concurrently. Race conditions in linking are resolved by throwing away the GuardedInvocation produced on the losing thread without incorporating it into the chain, so it can lead to repeated linking for the same arguments.

Constructors

Constructor Description
ChainedCallSite​(CallSiteDescriptor descriptor)

Creates a new chained call site.

Methods

Modifier and Type Method Description
protected int getMaxChainLength()

The maximum number of method handles in the chain.

Methods declared in class java.lang.invoke.MutableCallSite

getTarget, setTarget, syncAll

Methods declared in class java.lang.invoke.CallSite

dynamicInvoker, 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

getDescriptor, initialize, relink, resetAndRelink

Constructors

ChainedCallSite

public ChainedCallSite(CallSiteDescriptor descriptor)

Creates a new chained call site.

Parameters:
descriptor - the descriptor for the call site.

Methods

getMaxChainLength

protected int getMaxChainLength()

The maximum number of method handles in the chain. Defaults to 8. You can override it in a subclass if you need to change the value.

Returns:
the maximum number of method handles in the chain. The return value is checked, and if your override returns a value less than 1, a RuntimeException will be thrown.

© 1993, 2020, 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/11/docs/api/jdk.dynalink/jdk/dynalink/support/ChainedCallSite.html