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.
| Modifier and Type | Field and Description |
|---|---|
| private Object | invocations
Contains the invocations currently linked into this call site's target. |
| private static final MethodHandle | |
| private static final MethodHandle |
| Access | Constructor and Description |
|---|---|
| public | ChainedCallSite(final CallSiteDescriptor
the descriptor for the call site. descriptor)Creates a new chained call site. |
| Modifier and Type | Method and Description |
|---|---|
| private static int | |
| protected int | 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, aRuntimeException will be thrown.The maximum number of method handles in the chain. |
| private MethodHandle | Returns: a method handle for prune-and-invokethe ultimate fallback for the chain passed from the dynamic linker. relinkAndInvoke, final MethodHandle prune)Creates a method that rebuilds our call chain, pruning it of any invalidated switchpoints, and then invokes that chain. |
| private MethodHandle | |
| public void | relink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke)
Implements jdk. This method will be called by the dynamic linker every time the call site
is relinked (but see
|
| private MethodHandle | relinkInternal(final GuardedInvocation invocation, final MethodHandle relink, final boolean reset, final boolean removeCatches)
|
| public void | resetAndRelink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke)
Implements jdk. 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
|
| invocations | back to summary |
|---|---|
| private Object invocations Contains the invocations currently linked into this call site's target. They are used when we are
relinking to rebuild the guardWithTest chain. Valid values for this field are: | |
| PRUNE_CATCHES | back to summary |
|---|---|
| private static final MethodHandle PRUNE_CATCHES | |
| PRUNE_SWITCHPOINTS | back to summary |
|---|---|
| private static final MethodHandle PRUNE_SWITCHPOINTS | |
| ChainedCallSite | back to summary |
|---|---|
| public ChainedCallSite(final CallSiteDescriptor descriptor) Creates a new chained call site.
| |
| checkMaxChainLength | back to summary |
|---|---|
| private static int checkMaxChainLength(final int maxChainLength) | |
| getMaxChainLength | back to summary |
|---|---|
| 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.
| |
| makePruneAndInvokeMethod | back to summary |
|---|---|
| private MethodHandle makePruneAndInvokeMethod(final MethodHandle relinkAndInvoke, final MethodHandle prune) Creates a method that rebuilds our call chain, pruning it of any invalidated switchpoints, and then invokes that chain.
| |
| prune | back to summary |
|---|---|
private MethodHandle prune(final MethodHandle relink, final boolean catches)
| |
| relink | back to summary |
|---|---|
| public void relink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke) Implements jdk. Doc from jdk. This method will be called by the dynamic linker every time the call site
is relinked (but see
| |
| relinkInternal | back to summary |
|---|---|
| private MethodHandle relinkInternal(final GuardedInvocation invocation, final MethodHandle relink, final boolean reset, final boolean removeCatches) | |
| resetAndRelink | back to summary |
|---|---|
| public void resetAndRelink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke) Implements jdk. Doc from jdk. 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
| |