|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectautohit.vm.VM
autohit.vm.SimVM
A VM for a Sim.
A VMNOp marks the bottom of the scope stack. If we ever pop a nop, there is nothing left to do.
Subroutine stack frames consist of the IP pointer (to calling instruction) in Integer form and the calling VMExecutable. When a the IP goes past the last instruction, the SimVM wil check the stack for a VMExecutable. If it sees one, it will assume it is the return from a subroutine. The LEFT is left alone, since this is how the subroutine passes a return value. If the subroutine specified a return, but it isn't set, the VM will log an error and use a blank return value. The subroutine depth (subDepth) will be incremented and decremented as we enter and leave routines. This helps up keep an exception from unravelling the entire VM.
Currently only the following MATH operations are implemented
+ = plus - = minus / = division * = multiply
ERRORS ----------
This VM expects the following environment variables to be set before the execute() method is called. If they aren't set, the defaults will be used.
EPG - Rewrite - 8May03
EPG - Add goto - 16Jul03
EPG - Add assert - 5Aug03
EPG - Add module shortcut - 9Aug03
autohit.vm
Field Summary |
Fields inherited from class autohit.vm.VM |
buf, core, errors, faults, ip, left, loader, myLog, process, right, rinjector, rootProgram, sname, state, STATE_ACTIVE_THRESHOLD, STATE_BUILDING, STATE_DONE, STATE_INVALID, STATE_NEW, STATE_NO_VM, STATE_PAUSED, STATE_RUNNING, TIME_GRAN |
Constructor Summary | |
SimVM()
Default Constructor. |
Method Summary | |
void |
construct()
Complete construction. |
void |
destruct()
Destroy. |
void |
execute()
Implements the inherited abstract method execute(). |
void |
prepare()
Prepare for execution of the first instruction. |
Methods inherited from class autohit.vm.VM |
attach, die, finalize, getState, init, pause, resume, setParentCore, start, ticks |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimVM()
Method Detail |
public void construct()
construct
in class VM
public void destruct() throws VMException
destruct
in class VM
VMException
public void prepare() throws java.lang.Exception
prepare
in class VM
Any
- exceptions it encounters.
java.lang.Exception
public void execute() throws VMException
This method will throw a VMException(VMException.DONE) if there are no more instructions that can be executed. (The ip is past the end of the exec Vector).
execute
in class VM
VMException
VMException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |