autohit
Class SimVM

java.lang.Object
  |
  +--autohit.vm.VM
        |
        +--autohit.SimVM

public class SimVM
extends VM

A VM for a Sim. This version does not handle scope caches for headers or body elements. I'm not sure how much faster they would make the VM, so I'll wait.


NOTES for Sim coders --------------------------------------------------
A string will only be resolved once, therefore a variable may only be substituted in a string once. No references to reference. :-)
SET. Both name and value will be resolved. All variables preceded with a '!' will be set on the registered transport. It will *not* be removed from the transport when it falls out of scope!

WAIT. This instruction will block the VM until the time expires.

-----------------------------------------------------------------------
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.

 VAR                | DESC                         | DEFAULT            |
 ------------------------------------------------------------------------
 $sname$            | Session name.  Added to log  | The Sim.name       |
                    | entries                      |                    |

 

See Also:
VM, Sim

Field Summary
 Log myLog
          The logging mechinism.
 Transport myTransport
          The transport mechinism.
 Verify myVerify
          The verificationt mechinism.
 
Fields inherited from class autohit.vm.VM
ip, scDirty, scope, state, STATE_DONE, STATE_NEW, STATE_NO_VM, STATE_PAUSED, STATE_RUNNING, TIME_GRAN, vars
 
Constructor Summary
SimVM(Sim theSim, Log logTarget, Transport theTransport, Verify theVerify)
          Constructor.
 
Method Summary
 void execute()
          Implements the inherited abstract method execute().
 void prepare()
          Prepare for execution of the first instruction.
 
Methods inherited from class autohit.vm.VM
discardScopeFrame, getIntegerVar, getState, getVar, pause, popScope, pushScope, removeVar, resume, setVar, start, subVar, ticks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myLog

public Log myLog
The logging mechinism.
See Also:
Log

myTransport

public Transport myTransport
The transport mechinism.
See Also:
Transport

myVerify

public Verify myVerify
The verificationt mechinism.
See Also:
Verify
Constructor Detail

SimVM

public SimVM(Sim theSim,
             Log logTarget,
             Transport theTransport,
             Verify theVerify)
Constructor. Will create the Sim VM but will not start execution; use the start() method for that.

This class assumes that the logging object has already been started.

Do NOT use the default constructor! Call this constructor.

Parameters:
theSim - the Sim to be executed.
logTarget - target for logging.
myTransport - transport mechanism to use. This is for future use; you can pass null to it.
myVerify - verification mechanism.
Method Detail

prepare

public void prepare()
             throws java.lang.Exception
Prepare for execution of the first instruction. We need to add environment variables. DO NOT call this method directly.
Throws:
Any - exceptions it encounters.
Overrides:
prepare in class VM

execute

public void execute()
             throws VMException
Implements the inherited abstract method execute(). Call this to execute a single instruction, The first call will be automatic after the inherited start() method is called. From there, the owning Object/Thread should call this method for each successive instruction to execute.

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).

We shall assume that a VMContext will handle threading issues.

Throws:
VMException -  
Overrides:
execute in class VM
See Also:
VMContext, VMException