#include <virtualMachine.h>
Collaboration diagram for virtualMachine:
Public Member Functions | |
virtualMachine () | |
~virtualMachine () | |
instruction | addInstruction (instructionPtr instrPtr) |
add an instruction | |
bool | replaceInstruction (instruction instr, instructionPtr instrPtr) |
replace the specified instruction with a instruction | |
uInt | getNumInstructions () |
get the current number of instructions | |
processId | run (program &prog) |
run the specified program and return the id of the process | |
void | kill (processId pid) |
kill the specified process | |
process * | getProcess (processId pid) |
get a pointer to the specified process | |
uInt | getNumProcesses () |
get the number of processes being executed | |
void | setNumUsedCycles (float num) |
set the number of steps per update | |
bool | activeProcesses () |
test if there are still active processes | |
void | step () |
step the virtual machine | |
void | update (float deltaT) |
update the virtual machine | |
Protected Member Functions | |
virtual bool | canBeExecuted (process &proc) |
test if the specified process can be executed | |
virtual bool | shouldBeTerminated (process &proc) |
test if the process should be terminated | |
virtual void | kill (process &proc) |
kills the specified process | |
Protected Attributes | |
std::vector< process * > | m_pProcesses |
vector of allocated processes | |
uInt | m_numProcesses |
number of running processes | |
idGen< recycleReleasedIds, noWrapAround > | m_processIdGen |
float | m_usedCycles |
uInt | m_idleCnt |
bool | m_activeProcesses |
Definition at line 19 of file virtualMachine.h.
|
Definition at line 23 of file virtualMachine.h. References m_activeProcesses, m_idleCnt, m_numProcesses, and m_usedCycles. |
|
Definition at line 6 of file virtualMachine.cpp. References m_pProcesses. |
|
test if there are still active processes
Definition at line 58 of file virtualMachine.h. References m_activeProcesses. |
|
add an instruction
Definition at line 17 of file virtualMachine.cpp. References addInstruction(), instruction, and instructionPtr. Referenced by addInstruction(). |
|
test if the specified process can be executed
Definition at line 167 of file virtualMachine.cpp. References canBeExecuted(), and process::isTerminated(). Referenced by canBeExecuted(), and step(). |
|
get the current number of instructions
Definition at line 37 of file virtualMachine.h. References uInt. |
|
get the number of processes being executed
Definition at line 49 of file virtualMachine.h. References m_numProcesses, and uInt. |
|
get a pointer to the specified process
Definition at line 89 of file virtualMachine.cpp. References getProcess(), and m_pProcesses. Referenced by getProcess(). |
|
kills the specified process
Definition at line 179 of file virtualMachine.cpp. References process::clean(), kill(), process::m_id, m_numProcesses, m_processIdGen, and recycleReleasedIds::releaseId(). |
|
kill the specified process
Definition at line 78 of file virtualMachine.cpp. References kill(), and m_pProcesses. |
|
replace the specified instruction with a instruction
Definition at line 24 of file virtualMachine.cpp. References replaceInstruction(), and WARN. Referenced by replaceInstruction(). |
|
run the specified program and return the id of the process
Definition at line 44 of file virtualMachine.cpp. References idGen< recycleReleasedIds, noWrapAround >::getId(), m_numProcesses, m_pProcesses, process::m_pProgram, m_processIdGen, processId, run(), process::spawnThread(), uInt, and WARN. Referenced by run(). |
|
set the number of steps per update
Definition at line 146 of file virtualMachine.cpp. References m_usedCycles, and setNumUsedCycles(). Referenced by setNumUsedCycles(). |
|
test if the process should be terminated
Definition at line 173 of file virtualMachine.cpp. References process::m_id, and shouldBeTerminated(). Referenced by shouldBeTerminated(), and step(). |
|
step the virtual machine
Definition at line 102 of file virtualMachine.cpp. References canBeExecuted(), instruction, thread::isTerminated(), kill(), m_activeProcesses, m_pProcesses, processId, shouldBeTerminated(), and threadId. Referenced by update(). |
|
update the virtual machine
Definition at line 153 of file virtualMachine.cpp. References m_idleCnt, m_usedCycles, step(), and update(). Referenced by update(). |
|
whether there were active processes during the last step Definition at line 98 of file virtualMachine.h. Referenced by activeProcesses(), step(), and virtualMachine(). |
|
Definition at line 94 of file virtualMachine.h. Referenced by update(), and virtualMachine(). |
|
number of running processes
Definition at line 87 of file virtualMachine.h. Referenced by getNumProcesses(), kill(), run(), and virtualMachine(). |
|
vector of allocated processes
Definition at line 84 of file virtualMachine.h. Referenced by getProcess(), kill(), run(), step(), and ~virtualMachine(). |
|
used to generate proccess ids and keep track of terminated processes Definition at line 91 of file virtualMachine.h. |
|
Definition at line 93 of file virtualMachine.h. Referenced by setNumUsedCycles(), update(), and virtualMachine(). |