public class MutableCallSite extends CallSite
Because it is an ordinary variable, other threads may not immediately observe the value of a
setTarget(MethodHandle)
unless external synchronization is used. If the result of
a setTarget(MethodHandle)
call must be observed by other threads, the syncAll(MutableCallSite[])
method may be used to force it to be synchronized.
The syncAll(MutableCallSite[])
call is likely to be expensive and should be used sparingly. Calls to
syncAll(MutableCallSite[])
should be batched whenever possible.
Constructor and Description |
---|
MutableCallSite(MethodHandle mutableTarget)
Create a MutableCallSite permanently set to the same type as the mutableTarget and using
the mutableTarget as the initial target value.
|
MutableCallSite(MethodType type)
Create a MutableCallSite with the MethodType type and an
initial target that throws IllegalStateException.
|
Modifier and Type | Method and Description |
---|---|
MethodHandle |
dynamicInvoker()
Return a MethodHandle equivalent to the invokedynamic instruction on this CallSite.
|
MethodHandle |
getTarget()
Return the target MethodHandle of the CallSite.
|
void |
setTarget(MethodHandle newTarget)
Set the CallSite's target to be nextTarget.
|
static void |
syncAll(MutableCallSite[] sites)
Forces the current target MethodHandle of each of the MutableCallSites in the sites array to be seen by all threads.
|
public MutableCallSite(MethodHandle mutableTarget) throws NullPointerException
mutableTarget
- - the initial target of the CallSiteNullPointerException
- - if the mutableTarget is null.public MutableCallSite(MethodType type) throws NullPointerException
type
- - the permanent type of this CallSite.NullPointerException
- - if the type is null.public final MethodHandle dynamicInvoker()
CallSite
dynamicInvoker
in class CallSite
public final MethodHandle getTarget()
CallSite
public void setTarget(MethodHandle newTarget)
CallSite
public static void syncAll(MutableCallSite[] sites) throws NullPointerException
If any of the elements in the sites array is null, a NullPointerException will be raised. It is undefined whether any of the sites may have been synchronized.
Note: it is valid for an implementation to use a volatile variable for the target value of MutableCallSite. In that case,
the syncAll(MutableCallSite[])
call becomes a no-op.
sites
- - the array of MutableCallSites to force to be synchronized.NullPointerException
- - if sites or any of its elements are null.Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 1993, 2023 IBM Corp. and others.