#include <vmcontext.h>
Public Member Functions | |
void | addLocals (uint32 space) |
Adds some space in the local stack for local variables. | |
void | atomicMode (bool b) |
bool | atomicMode () const |
byte * | code () const |
Returns the current code. | |
void | createFrame (uint32 pcount, ext_func_frame_t frameEndFunc=0) |
Creates a stack frame taking a certain number of parameters. | |
StackFrame * | currentFrame () const |
The currently active frame in this context. | |
const ItemArray & | globals () const |
Returns the current module global variables vector (const version). | |
ItemArray & | globals () |
Returns the current module global variables vector. | |
bool | isWaitingForever () const |
Return true if this is waiting forever on a semaphore signal. | |
Item & | latch () |
Latch item. | |
const Item & | latch () const |
Latch item. | |
Item & | latcher () |
Latcher item. | |
const Item & | latcher () const |
Latcher item. | |
void | lmodule (LiveModule *lm) |
Changes the currently active live module. | |
LiveModule * | lmodule () const |
Returns the currently active live module. | |
Item * | local (uint32 itemId) |
Returns the nth local item. | |
const Item * | local (uint32 itemId) const |
Returns the nth local item. | |
const uint32 & | pc () const |
uint32 & | pc () |
const uint32 & | pc_next () const |
uint32 & | pc_next () |
int32 | priority () const |
void | priority (int32 value) |
void | pushParameter (const Item &item) |
Pushes a parameter for the vm callItem and callFrame functions. | |
const Item & | regA () const |
Item & | regA () |
const Item & | regB () const |
Item & | regB () |
const Item & | regBind () const |
Item & | regBind () |
const Item & | regBindP () const |
Item & | regBindP () |
ext_func_frame_t | returnHandler () const |
void | returnHandler (ext_func_frame_t callbackFunc) |
Installs a post-processing return frame handler. | |
numeric | schedule () const |
void | schedule (numeric value) |
void | scheduleAfter (numeric secs) |
Schedule this context after some time from now. | |
const Item & | self () const |
Item & | self () |
void | signaled () |
VMSemaphore * | sleepingOn () const |
void | sleepOn (VMSemaphore *sl) |
const ItemArray & | stack () const |
ItemArray & | stack () |
const uint32 & | stackBase () const |
uint32 & | stackBase () |
void | symbol (const Symbol *s) |
Changes the currently active symbol. | |
const Symbol * | symbol () const |
Returns the currently active symbol. | |
const uint32 & | tryFrame () const |
uint32 & | tryFrame () |
VMContext (const VMContext &other) | |
VMContext () | |
VMSemaphore * | waitingOn () const |
void | waitOn (VMSemaphore *sem, numeric value=-1) |
void | wakeup (bool signaled=false) |
Wakes up the context after a wait. | |
~VMContext () | |
Friends | |
class | VMSemaphore |
Falcon::VMContext::VMContext | ( | ) |
Falcon::VMContext::VMContext | ( | const VMContext & | other | ) |
Falcon::VMContext::~VMContext | ( | ) |
void Falcon::VMContext::addLocals | ( | uint32 | space | ) | [inline] |
Adds some space in the local stack for local variables.
Referenced by Falcon::VMachine::addLocals().
void Falcon::VMContext::atomicMode | ( | bool | b | ) | [inline] |
bool Falcon::VMContext::atomicMode | ( | ) | const [inline] |
byte* Falcon::VMContext::code | ( | ) | const [inline] |
Returns the current code.
References fassert.
Referenced by Falcon::VMachine::getNextNTD32(), Falcon::VMachine::getNextNTD64(), and Falcon::VMachine::operandType().
void Falcon::VMContext::createFrame | ( | uint32 | pcount, | |
ext_func_frame_t | frameEndFunc = 0 | |||
) |
Creates a stack frame taking a certain number of parameters.
The frame is created directly in the stack of this context.
paramCount | number of parameters in the stack | |
frameEndFunc | Callback function to be executed at frame end |
Referenced by Falcon::VMachine::createFrame().
StackFrame* Falcon::VMContext::currentFrame | ( | ) | const [inline] |
The currently active frame in this context.
References VM_FRAME_SPACE.
Referenced by Falcon::VMachine::currentFrame().
const ItemArray& Falcon::VMContext::globals | ( | ) | const [inline] |
Returns the current module global variables vector (const version).
ItemArray& Falcon::VMContext::globals | ( | ) | [inline] |
Returns the current module global variables vector.
Referenced by Falcon::VMachine::currentGlobals().
bool Falcon::VMContext::isWaitingForever | ( | ) | const [inline] |
Return true if this is waiting forever on a semaphore signal.
Item& Falcon::VMContext::latch | ( | ) | [inline] |
Latch item.
Generated on load property/vector instructions, it stores the accessed object.
const Item& Falcon::VMContext::latch | ( | ) | const [inline] |
Latch item.
Generated on load property/vector instructions, it stores the accessed object.
Referenced by Falcon::VMachine::latch().
Item& Falcon::VMContext::latcher | ( | ) | [inline] |
Latcher item.
Generated on load property/vector instructions, it stores the accessor item.
const Item& Falcon::VMContext::latcher | ( | ) | const [inline] |
Latcher item.
Generated on load property/vector instructions, it stores the accessor item.
Referenced by Falcon::VMachine::latcher().
void Falcon::VMContext::lmodule | ( | LiveModule * | lm | ) | [inline] |
Changes the currently active live module.
LiveModule* Falcon::VMContext::lmodule | ( | ) | const [inline] |
Returns the currently active live module.
Referenced by Falcon::VMachine::currentLiveModule(), and Falcon::VMachine::currentModule().
Returns the nth local item.
This is just the non-const version. The first variable in the local context is numbered 0.
itemId | the number of the local item accessed. |
Returns the nth local item.
The first variable in the local context is numbered 0.
itemId | the number of the local item accessed. |
Referenced by Falcon::VMachine::local().
const uint32& Falcon::VMContext::pc | ( | ) | const [inline] |
uint32& Falcon::VMContext::pc | ( | ) | [inline] |
const uint32& Falcon::VMContext::pc_next | ( | ) | const [inline] |
uint32& Falcon::VMContext::pc_next | ( | ) | [inline] |
int32 Falcon::VMContext::priority | ( | ) | const [inline] |
void Falcon::VMContext::priority | ( | int32 | value | ) | [inline] |
void Falcon::VMContext::pushParameter | ( | const Item & | item | ) | [inline] |
Pushes a parameter for the vm callItem and callFrame functions.
callFrame
item | the item to be passes as a parameter to the next call. |
Referenced by Falcon::VMachine::pushParameter().
const Item& Falcon::VMContext::regA | ( | ) | const [inline] |
Item& Falcon::VMContext::regA | ( | ) | [inline] |
Referenced by Falcon::VMachine::regA(), Falcon::VMachine::retnil(), and Falcon::VMachine::retval().
const Item& Falcon::VMContext::regB | ( | ) | const [inline] |
Item& Falcon::VMContext::regB | ( | ) | [inline] |
Referenced by Falcon::VMachine::regB().
const Item& Falcon::VMContext::regBind | ( | ) | const [inline] |
Item& Falcon::VMContext::regBind | ( | ) | [inline] |
Referenced by Falcon::VMachine::regBind(), and Falcon::VMachine::setBindingContext().
const Item& Falcon::VMContext::regBindP | ( | ) | const [inline] |
Item& Falcon::VMContext::regBindP | ( | ) | [inline] |
Referenced by Falcon::VMachine::regBindP().
ext_func_frame_t Falcon::VMContext::returnHandler | ( | ) | const [inline] |
References VM_FRAME_SPACE.
void Falcon::VMContext::returnHandler | ( | ext_func_frame_t | callbackFunc | ) | [inline] |
Installs a post-processing return frame handler.
The function passed as a parmeter will receive a pointer to this VM.
The function MUST return true if it performs another frame item call. This will tell the VM that the stack cannot be freed now, as a new call stack has been prepared for immediate execution. When done, the function will be called again.
A frame handler willing to call another frame and not willing to be called anymore must first unininstall itself by calling this method with parameters set at 0, and then it MUST return true.
A frame handler not installing a new call frame MUST return false. This will terminate the current stack frame and cause the VM to complete the return stack.
callbackFunct | the return frame handler, or 0 to disinstall a previously set handler. |
Referenced by Falcon::VMachine::returnHandler().
numeric Falcon::VMContext::schedule | ( | ) | const [inline] |
void Falcon::VMContext::schedule | ( | numeric | value | ) | [inline] |
void Falcon::VMContext::scheduleAfter | ( | numeric | secs | ) |
Schedule this context after some time from now.
This function add the current system time to secs and prepares this context to be scheduled after that absolute time.
secs | Number of seconds and fraction after current time. |
const Item& Falcon::VMContext::self | ( | ) | const [inline] |
Item& Falcon::VMContext::self | ( | ) | [inline] |
Referenced by Falcon::VMachine::self().
void Falcon::VMContext::signaled | ( | ) |
VMSemaphore* Falcon::VMContext::sleepingOn | ( | ) | const [inline] |
void Falcon::VMContext::sleepOn | ( | VMSemaphore * | sl | ) | [inline] |
const ItemArray& Falcon::VMContext::stack | ( | ) | const [inline] |
ItemArray& Falcon::VMContext::stack | ( | ) | [inline] |
Referenced by Falcon::VMachine::stack().
const uint32& Falcon::VMContext::stackBase | ( | ) | const [inline] |
uint32& Falcon::VMContext::stackBase | ( | ) | [inline] |
Referenced by Falcon::VMachine::isParamByRef(), Falcon::VMachine::param(), and Falcon::VMachine::stackBase().
void Falcon::VMContext::symbol | ( | const Symbol * | s | ) | [inline] |
Changes the currently active symbol.
const Symbol* Falcon::VMContext::symbol | ( | ) | const [inline] |
const uint32& Falcon::VMContext::tryFrame | ( | ) | const [inline] |
uint32& Falcon::VMContext::tryFrame | ( | ) | [inline] |
Referenced by Falcon::VMachine::tryFrame().
VMSemaphore* Falcon::VMContext::waitingOn | ( | ) | const [inline] |
void Falcon::VMContext::waitOn | ( | VMSemaphore * | sem, | |
numeric | value = -1 | |||
) |
void Falcon::VMContext::wakeup | ( | bool | signaled = false |
) |
Wakes up the context after a wait.
friend class VMSemaphore [friend] |