Package org.spf4j.zel.vm
Class ExecutionContext
- java.lang.Object
-
- org.spf4j.zel.vm.ExecutionContext
-
- All Implemented Interfaces:
Callable<Object>,VMExecutor.Suspendable<Object>
@ParametersAreNonnullByDefault public final class ExecutionContext extends Object implements VMExecutor.Suspendable<Object>
Virtual Machine Execution Context- Author:
- zoly
-
-
Constructor Summary
Constructors Constructor Description ExecutionContext(Program program, Object[] globalMem, Object[] localMem, ProcessIO io, VMExecutor execService)
-
Method Summary
-
-
-
Field Detail
-
VOID
public static final Object VOID
-
-
Method Detail
-
getIo
public ProcessIO getIo()
-
newJavaCall
public JavaMethodCall newJavaCall(Object object, String method)
-
getMem
public Object[] getMem()
-
globalPoke
public void globalPoke(int addr, Object value)
-
localPoke
public void localPoke(int addr, Object value)
-
localPeek
public Object localPeek(int addr)
-
globalPeek
public Object globalPeek(int addr)
-
getProgram
public Program getProgram()
-
incrementInstructionPointer
public void incrementInstructionPointer()
-
terminate
public void terminate()
-
executeSyncOrAsync
public Object executeSyncOrAsync() throws ExecutionException, InterruptedException
-
executeAsync
public Object executeAsync() throws ExecutionException, InterruptedException
-
suspend
public void suspend(VMFuture<Object> future) throws SuspendedException
- Throws:
SuspendedException
-
suspend
public void suspend(List<VMFuture<Object>> futures) throws SuspendedException
- Throws:
SuspendedException
-
call
public Object call() throws ExecutionException, InterruptedException, SuspendedException
- Specified by:
callin interfaceCallable<Object>- Specified by:
callin interfaceVMExecutor.Suspendable<Object>- Throws:
ExecutionExceptionInterruptedExceptionSuspendedException
-
getSuspendedAt
public List<VMFuture<Object>> getSuspendedAt()
- Specified by:
getSuspendedAtin interfaceVMExecutor.Suspendable<Object>
-
popSyncStackVal
public Object popSyncStackVal() throws SuspendedException, ExecutionException
pops object out of stack- Returns:
- Object
- Throws:
SuspendedExceptionExecutionException
-
peekSyncStackVal
public Object peekSyncStackVal() throws SuspendedException, ExecutionException
- Throws:
SuspendedExceptionExecutionException
-
syncStackVal
public void syncStackVal() throws SuspendedException, ExecutionException- Throws:
SuspendedExceptionExecutionException
-
syncStackVals
public void syncStackVals() throws SuspendedException, ExecutionException- Throws:
SuspendedExceptionExecutionException
-
popStackVals
public Object[] popStackVals(int nvals)
-
popStackVals
public void popStackVals(Object[] to, int nvals)
-
popStackVal
public Object popStackVal()
-
getNrStackVals
public int getNrStackVals()
-
popSyncStackVals
public Object[] popSyncStackVals(int nvals) throws SuspendedException, ExecutionException
- Throws:
SuspendedExceptionExecutionException
-
tuple
public Object[] tuple()
-
popSyncStackVals
public void popSyncStackVals(Object[] vals) throws SuspendedException, ExecutionException
- Throws:
SuspendedExceptionExecutionException
-
popSyncStackVals
public void popSyncStackVals(Object[] vals, int l) throws ExecutionException, SuspendedException
- Throws:
ExecutionExceptionSuspendedException
-
popFirstAvail
public Object popFirstAvail(int nr) throws SuspendedException
- Throws:
SuspendedException
-
pop
public Object pop()
-
pushNull
public void pushNull()
-
isStackEmpty
public boolean isStackEmpty()
-
peek
public Object peek()
-
peekFromTop
public Object peekFromTop(int n)
-
getSubProgramContext
public ExecutionContext getSubProgramContext(Program program, int nrParams) throws ExecutionException, SuspendedException
- Throws:
ExecutionExceptionSuspendedException
-
getSyncSubProgramContext
public ExecutionContext getSyncSubProgramContext(Program program, int nrParams) throws ExecutionException, SuspendedException
- Throws:
ExecutionExceptionSuspendedException
-
getSyncSubProgramContext
public ExecutionContext getSyncSubProgramContext(Program program, Object[] parameters)
-
isChildContext
public boolean isChildContext()
-
getMathContext
@Nonnull public MathContext getMathContext()
- Returns:
- the mathContext
-
setMathContext
public void setMathContext(@Nonnull MathContext mathContext)
- Parameters:
mathContext- the mathContext to set
-
getExecService
@Nullable public VMExecutor getExecService()
- Returns:
- the execService
-
getResultCache
public ResultCache getResultCache()
- Returns:
- the resultCache
-
-