
Go to the source code of this file.
Data Structures | |
| struct | RTH_StackFrame |
| Describes everything you need to resume execution: a function, a program counter, and local variables. More... | |
| class | RTH_Runtime |
| Describes everything associated with a flow of control-- execution stack, objects, and other housekeeping. More... | |
Enumerations | |
| enum | { PC_START = 0 } |
Functions | |
| RTH_Locals * | allocLocals (int localsSize) |
| void | freeLocals (RTH_Locals *locals) |
| RTH_Runtime * | RTH_Runtime_create (RTH_Routine fn, int localsSize, void *obj) |
| Create a new RTH runtime that will run this function on its first "resume" call. | |
| RTH_Runtime * | RTH_Runtime_pup (RTH_Runtime *runtime, PUP::er &p, void *obj) |
| Pup this RTH_Runtime. | |
| void | RTH_Runtime_suspend (RTH_Runtime *runtime, int nextPC) |
| "Block" this RTH thread. | |
| void | RTH_Runtime_resume (RTH_Runtime *runtime) |
| Resume the blocked RTH thread immediately. | |
| void | RTH_Runtime_done (RTH_Runtime *runtime) |
| Called at the end of an RTH routine. | |
| void | RTH_Runtime_destroy (RTH_Runtime *runtime) |
| Dispose of the RTH runtime. | |
| int | RTH_Runtime_call (RTH_Runtime *runtime, RTH_Routine fn, int localsSize, int nextPC) |
| Call this RTH subroutine inline. | |
| RTH_Locals* allocLocals | ( | int | localsSize | ) |
| void freeLocals | ( | RTH_Locals * | locals | ) |
Definition at line 44 of file RTH.C.
References RTH_Locals::~RTH_Locals().
Referenced by RTH_Runtime::pop().
| RTH_Runtime* RTH_Runtime_create | ( | RTH_Routine | fn, | |
| int | localsSize, | |||
| void * | obj | |||
| ) |
Create a new RTH runtime that will run this function on its first "resume" call.
Definition at line 122 of file RTH.C.
References PC_START, and RTH_StackFrame::RTH_StackFrame().
| RTH_Runtime* RTH_Runtime_pup | ( | RTH_Runtime * | runtime, | |
| PUP::er & | p, | |||
| void * | obj | |||
| ) |
Pup this RTH_Runtime.
This routine can be called on an uninitialized RTH_Runtime if the PUP::er is unpacking. This does *not* free the RTH_Runtime, so call RTH_Runtime_free in your destructor as usual.
Definition at line 126 of file RTH.C.
References PUP::er::isUnpacking(), RTH_Runtime::pup(), and RTH_StackFrame::RTH_StackFrame().
| void RTH_Runtime_suspend | ( | RTH_Runtime * | runtime, | |
| int | nextPC | |||
| ) |
"Block" this RTH thread.
Saves the currently running function and returnPC for later "resume" call. Unlike a real thread, this routine returns, and you're expected to then exit the calling RTH routine immediately.
Definition at line 139 of file RTH.C.
References RTH_StackFrame::pc, and RTH_Runtime::tos().
| void RTH_Runtime_resume | ( | RTH_Runtime * | runtime | ) |
Resume the blocked RTH thread immediately.
This call will not return until the thread blocks or finishes.
Definition at line 146 of file RTH.C.
References RTH_StackFrame::invoke(), RTH_Runtime::terminated, and RTH_Runtime::tos().
| void RTH_Runtime_done | ( | RTH_Runtime * | runtime | ) |
Called at the end of an RTH routine.
Allows the next routine to be started.
Definition at line 154 of file RTH.C.
References RTH_StackFrame::invoke(), RTH_StackFrame::pc, PC_START, RTH_Runtime::pop(), and RTH_Runtime::tos().
| void RTH_Runtime_destroy | ( | RTH_Runtime * | runtime | ) |
| int RTH_Runtime_call | ( | RTH_Runtime * | runtime, | |
| RTH_Routine | fn, | |||
| int | localsSize, | |||
| int | nextPC | |||
| ) |
Call this RTH subroutine inline.
Definition at line 172 of file RTH.C.
References RTH_StackFrame::invoke(), RTH_StackFrame::pc, PC_START, RTH_Runtime::push(), RTH_StackFrame::RTH_StackFrame(), and RTH_Runtime::tos().
1.5.5