physis.core.virtualmachine
Class VirtualMachine
java.lang.Object
|
+--physis.core.virtualmachine.VirtualMachine
- Direct Known Subclasses:
- ParallelVirtualMachine, PhysisVirtualMachine
- public abstract class VirtualMachine
- extends java.lang.Object
It is the base class for all virtual machines, which executes the code tapes.
Subclasses of this class may represent concrete CPUs. They have to define their states with registers,
stacks or whatever.
This VM has its own stored executable program in its codetape.
The instructions are represented with integers, which are hardcoded in the main execute loop.
(The instruction names can be obtained from InstructionSet)
All the VMs should have corresponding instruction set.
All virtual machines should be computationally universal!
- See Also:
InstructionSet
|
Constructor Summary |
VirtualMachine()
It should have one zero-argument constructor!
Because a separate factory instantiates them. |
|
Method Summary |
abstract void |
execute()
Calling this method forces the machine to execute the next instruction. |
abstract void |
execute(int number_of_instructions)
Calling this method forces te VM to execute the next N instructions. |
abstract java.lang.String |
getState()
Returns the String representation of the current state of the virtualmachine including all stacks registers
in the architecture and the instruction point by the instructionpointer: etc. |
abstract void |
reset()
Resets the virtual machine's state. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
VirtualMachine
public VirtualMachine()
- It should have one zero-argument constructor!
Because a separate factory instantiates them.
execute
public abstract void execute()
- Calling this method forces the machine to execute the next instruction.
(Execution step by step).
execute
public abstract void execute(int number_of_instructions)
- Calling this method forces te VM to execute the next N instructions.
- Parameters:
number_of_instructions - The exact number of the instructions to be executed.
reset
public abstract void reset()
- Resets the virtual machine's state.
getState
public abstract java.lang.String getState()
- Returns the String representation of the current state of the virtualmachine including all stacks registers
in the architecture and the instruction point by the instructionpointer: etc.
It's mainly used by the debuggers or tracers.