public abstract class JavaVMOperation extends VMOperation implements VMOperationControl.JavaAllocationFreeQueue.Element<JavaVMOperation>
NativeVMOperation
). JavaVMOperation
objects should be short lived and only
enqueued/executed once. For increased thread safety, it is prohibited to allocate
JavaVMOperation
s that live in the image heap (see note below).
Note: the VM operation infrastructure supports that JavaVMOperation
s are reused and
executed multiple times. However, extra care must be taken as each VM operation object can only
be in the VM operation queue once. Therefore, it must be guaranteed that the VM operation is
executed before it is enqueued again. Otherwise, this could result in various race conditions,
especially if SubstrateOptions.UseDedicatedVMOperationThread is enabled.
Modifier and Type | Class and Description |
---|---|
static class |
JavaVMOperation.ThunkOperation
A VMOperation that executes a thunk.
|
VMOperation.SystemEffect
Modifier and Type | Field and Description |
---|---|
protected org.graalvm.nativeimage.IsolateThread |
queuingThread |
Modifier | Constructor and Description |
---|---|
protected |
JavaVMOperation(String name,
VMOperation.SystemEffect systemEffect) |
Modifier and Type | Method and Description |
---|---|
void |
enqueue() |
static void |
enqueueBlockingNoSafepoint(String name,
SubstrateUtil.Thunk thunk)
Convenience method for thunks that can be run by allocating a VMOperation.
|
static void |
enqueueBlockingSafepoint(String name,
SubstrateUtil.Thunk thunk)
Convenience method for thunks that can be run by allocating a VMOperation.
|
JavaVMOperation |
getNext() |
protected org.graalvm.nativeimage.IsolateThread |
getQueuingThread(NativeVMOperationData data) |
protected boolean |
hasWork() |
protected boolean |
hasWork(NativeVMOperationData data)
Used to determine if a VM operation must be executed or if it can be skipped.
|
protected boolean |
isFinished(NativeVMOperationData data) |
protected abstract void |
operate() |
void |
operate(NativeVMOperationData data) |
protected void |
setFinished(NativeVMOperationData data,
boolean value) |
void |
setNext(JavaVMOperation value) |
protected void |
setQueuingThread(NativeVMOperationData data,
org.graalvm.nativeimage.IsolateThread thread) |
execute, getCausesSafepoint, getName, guaranteeGCInProgress, guaranteeInProgress, guaranteeInProgressAtSafepoint, guaranteeNotInProgress, isGC, isGCInProgress, isInProgress, isInProgressAtSafepoint
protected JavaVMOperation(String name, VMOperation.SystemEffect systemEffect)
public JavaVMOperation getNext()
getNext
in interface VMOperationControl.JavaAllocationFreeQueue.Element<JavaVMOperation>
public void setNext(JavaVMOperation value)
setNext
in interface VMOperationControl.JavaAllocationFreeQueue.Element<JavaVMOperation>
public void enqueue()
protected org.graalvm.nativeimage.IsolateThread getQueuingThread(NativeVMOperationData data)
getQueuingThread
in class VMOperation
protected void setQueuingThread(NativeVMOperationData data, org.graalvm.nativeimage.IsolateThread thread)
setQueuingThread
in class VMOperation
protected boolean isFinished(NativeVMOperationData data)
isFinished
in class VMOperation
protected void setFinished(NativeVMOperationData data, boolean value)
setFinished
in class VMOperation
protected final boolean hasWork(NativeVMOperationData data)
VMOperation
hasWork
in class VMOperation
protected boolean hasWork()
public static void enqueueBlockingSafepoint(String name, SubstrateUtil.Thunk thunk)
public static void enqueueBlockingNoSafepoint(String name, SubstrateUtil.Thunk thunk)
public final void operate(NativeVMOperationData data)
operate
in class VMOperation
protected abstract void operate()