Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CMa::Interpreter< Word, Int, Heap, FreeStore, Code > Class Template Reference

#include <interpreter.h>

List of all members.

Protected Methods

void readOperation (Op::Code &opCode, Int codeArg[], Int &newPC, Int &newSP) throw (Error)
 Command to identify next instruction and calculate newSP,newPC and possible code argument.


Detailed Description

template<class Word, class Int, class Heap, class FreeStore, class Code>
class CMa::Interpreter< Word, Int, Heap, FreeStore, Code >

An interpeter for the CMa that is parametrized with machine word class (Word), machine integer class (Int), heap implementation (Heap), free store imeplementation (FreeStore), and code segment implementation (Code).

Assumptions:

Validity of C-machine instructions is tested at runtime. Proper errors are raised before executing invalid instructions. Possible errors are: Implementation of the C-machine is realised by private functions look operations.h for further details.

Author:
OM/modified by SL
STATUS: NOT TESTED

TODO: Verify readoperation and functions in operations.h


Member Function Documentation

template<class Word, class Int, class Heap, class FreeStore, class Code>
void CMa::Interpreter< Word, Int, Heap, FreeStore, Code >::readOperation Op::Code   opCode,
Int    codeArg[],
Int &    newPC,
Int &    newSP
throw (Error) [inline, protected]
 

Command to identify next instruction and calculate newSP,newPC and possible code argument.

Reads in one instruction and its argument from the code. Computes the new values of PC(newPC) and SP(newSP) FOR ALL INSTRUCTIONS. Raises errors when instruction would corrupt state of stack or instruction is unknown:

  • STACK_UNDERFLOW
  • STACK_OVERFLOW
  • WRONG_OP_CODE
  • WRONG_ARGUMENT_ADDRESS
Hidden assumptions:
  • SP is valid
  • FP is valid
  • codeArg has at least CMA_MAX_OP_CODE_ARG_COUNT elements
It ensures that newSP is valid under current EP, NP, FP and nothing more.
Parameters:
opCode  operation code
codeArg  operation arguments extracted from the code segment As most of the uses of code arguments require conversion to Int the result type is Int.
newPC  the value of PC after executing this instruction
newSP  the value of SP after executing this instruction
Author:
OM/modified by SL
TODO: Verify correctness.


The documentation for this class was generated from the following file:
Generated on Tue Oct 12 03:30:46 1999 by doxygen1.2.18