Wolframe, 0.0.3

_Wolframe::db::vm::InstructionSet Class Reference

Enumeration of instructions for the transaction VM with some static functions on them. More...

#include <instructionSet.hpp>

Inheritance diagram for _Wolframe::db::vm::InstructionSet:
_Wolframe::db::vm::ProgramImage _Wolframe::db::vm::ProgramInstance

Public Types

enum  OpCode {
  Op_EXIT, Op_RETURN, Op_GOTO, Op_OUTPUT_CONST,
  Op_OUTPUT_PATH, Op_OUTPUT_LOOPCNT, Op_OUTPUT_SEL_IDX, Op_OUTPUT_SEL_NAM,
  Op_OUTPUT_ITR_IDX, Op_OUTPUT_ITR_NAM, Op_OUTPUT_ITR_COLUMN, Op_OUTPUT_OPEN_ARRAY,
  Op_OUTPUT_OPEN_ELEM, Op_OUTPUT_OPEN, Op_OUTPUT_CLOSE_ARRAY, Op_OUTPUT_CLOSE_ELEM,
  Op_OUTPUT_CLOSE, Op_OUTPUT_ADD_SINK, Op_KEEP_RESULT, Op_SELECT_PARAMETER,
  Op_SELECT_LAST_RESULT, Op_SELECT_KEPT_RESULT, Op_OPEN_ITER_LAST_RESULT, Op_OPEN_ITER_KEPT_RESULT,
  Op_OPEN_ITER_PATH, Op_OPEN_ITER_TUPLESET, Op_NEXT, Op_SUB_FRAME_OPEN,
  Op_SUB_ARG_CONST, Op_SUB_ARG_PATH, Op_SUB_ARG_LOOPCNT, Op_SUB_ARG_SEL_IDX,
  Op_SUB_ARG_SEL_NAM, Op_SUB_ARG_ITR_IDX, Op_SUB_ARG_ITR_NAM, Op_SUB_FRAME_CLOSE,
  Op_SCOPE_OPEN, Op_SCOPE_CLOSE, Op_DBSTM_START, Op_DBSTM_BIND_CONST,
  Op_DBSTM_BIND_PATH, Op_DBSTM_BIND_LOOPCNT, Op_DBSTM_BIND_SEL_IDX, Op_DBSTM_BIND_SEL_NAM,
  Op_DBSTM_BIND_ITR_IDX, Op_DBSTM_BIND_ITR_NAM, Op_DBSTM_HINT, Op_DBSTM_EXEC,
  Op_RESULT_SET_INIT, Op_RESULT_CONSTRAINT_UNIQUE, Op_RESULT_CONSTRAINT_NONEMPTY, Op_NOP
}
 Implemented operation codes of the VM. More...
 
enum  ArgumentType {
  At_None, At_Address, At_Path, At_Constant,
  At_ColumnName, At_TagName, At_ResultName, At_Statement,
  At_Hint, At_SubroutineSignature, At_TupleSet, At_SelectedColumnIdx,
  At_IteratorColumnIdx
}
 Enumeration of argument types. More...
 
enum  CondCode { Co_ALWAYS, Co_IF_COND, Co_NOT_IF_COND }
 Enumeration of conditional codes. More...
 
enum  { Max_OpCode =((1<<BitCnt_OpCode)-1), Max_CondCode =((1<<BitCnt_CondCode)-1), Max_ArgumentIndex =((1<<BitCnt_ArgumentIndex)-1) }
 
typedef boost::uint32_t ArgumentIndex
 Index of an argument. More...
 
typedef boost::uint32_t Address
 Address in program code. More...
 
typedef boost::uint32_t Instruction
 Instruction. More...
 

Static Public Member Functions

static const char * opCodeName (OpCode i)
 
static const char * argumentTypeName (ArgumentType i)
 Get the name of an argument type. More...
 
static ArgumentType argumentType (OpCode i)
 get the argument type of an operation More...
 
static const char * condCodeName (CondCode i)
 Get the name of a conditional code. More...
 
static Instruction instruction (CondCode cond, OpCode opcode, unsigned int arg=0)
 Build an instruction from its parts. More...
 
static Instruction instruction (OpCode opcode, unsigned int arg=0)
 Build an instruction from its parts (no condition -> always executed) More...
 
static CondCode condCode (const Instruction &instr)
 Get the condition code of an instruction (defining on which condition the instruction is executed) More...
 
static OpCode opCode (const Instruction &instr)
 Get the operation code of an instruction (defining what is done on execution) More...
 
static ArgumentIndex argumentIndex (const Instruction &instr)
 Get the argument index of the instruction (addressing the argument depending on the argument type of the instruction) More...
 
static void printProgramRaw (std::ostream &out, const std::vector< Instruction > &prg)
 Print the program code without any symbolic information that is not available here. More...
 
static std::string instructionstr (const Instruction &instr)
 Get the instruction as string. More...
 

Private Types

enum  {
  BitCnt_OpCode =6, Shift_OpCode =26, BitCnt_CondCode =2, Shift_CondCode =24,
  BitCnt_ArgumentIndex =20, Shift_ArgumentIndex =0
}
 
enum  { Mask_OpCode =(Max_OpCode << Shift_OpCode), Mask_CondCode =(Max_CondCode << Shift_CondCode), Mask_ArgumentIndex =(Max_ArgumentIndex << Shift_ArgumentIndex) }
 

Detailed Description

Enumeration of instructions for the transaction VM with some static functions on them.

Member Typedef Documentation

Address in program code.

Index of an argument.

Instruction.

Member Enumeration Documentation

anonymous enum
private
Enumerator
BitCnt_OpCode 
Shift_OpCode 
BitCnt_CondCode 
Shift_CondCode 
BitCnt_ArgumentIndex 
Shift_ArgumentIndex 
anonymous enum
Enumerator
Max_OpCode 
Max_CondCode 
Max_ArgumentIndex 
anonymous enum
private
Enumerator
Mask_OpCode 
Mask_CondCode 
Mask_ArgumentIndex 

Enumeration of argument types.

Enumerator
At_None 
At_Address 
At_Path 
At_Constant 
At_ColumnName 
At_TagName 
At_ResultName 
At_Statement 
At_Hint 
At_SubroutineSignature 
At_TupleSet 
At_SelectedColumnIdx 
At_IteratorColumnIdx 

Enumeration of conditional codes.

Enumerator
Co_ALWAYS 
Co_IF_COND 
Co_NOT_IF_COND 

Implemented operation codes of the VM.

Enumerator
Op_EXIT 
Op_RETURN 
Op_GOTO 
Op_OUTPUT_CONST 
Op_OUTPUT_PATH 
Op_OUTPUT_LOOPCNT 
Op_OUTPUT_SEL_IDX 
Op_OUTPUT_SEL_NAM 
Op_OUTPUT_ITR_IDX 
Op_OUTPUT_ITR_NAM 
Op_OUTPUT_ITR_COLUMN 
Op_OUTPUT_OPEN_ARRAY 
Op_OUTPUT_OPEN_ELEM 
Op_OUTPUT_OPEN 
Op_OUTPUT_CLOSE_ARRAY 
Op_OUTPUT_CLOSE_ELEM 
Op_OUTPUT_CLOSE 
Op_OUTPUT_ADD_SINK 
Op_KEEP_RESULT 
Op_SELECT_PARAMETER 
Op_SELECT_LAST_RESULT 
Op_SELECT_KEPT_RESULT 
Op_OPEN_ITER_LAST_RESULT 
Op_OPEN_ITER_KEPT_RESULT 
Op_OPEN_ITER_PATH 
Op_OPEN_ITER_TUPLESET 
Op_NEXT 
Op_SUB_FRAME_OPEN 
Op_SUB_ARG_CONST 
Op_SUB_ARG_PATH 
Op_SUB_ARG_LOOPCNT 
Op_SUB_ARG_SEL_IDX 
Op_SUB_ARG_SEL_NAM 
Op_SUB_ARG_ITR_IDX 
Op_SUB_ARG_ITR_NAM 
Op_SUB_FRAME_CLOSE 
Op_SCOPE_OPEN 
Op_SCOPE_CLOSE 
Op_DBSTM_START 
Op_DBSTM_BIND_CONST 
Op_DBSTM_BIND_PATH 
Op_DBSTM_BIND_LOOPCNT 
Op_DBSTM_BIND_SEL_IDX 
Op_DBSTM_BIND_SEL_NAM 
Op_DBSTM_BIND_ITR_IDX 
Op_DBSTM_BIND_ITR_NAM 
Op_DBSTM_HINT 
Op_DBSTM_EXEC 
Op_RESULT_SET_INIT 
Op_RESULT_CONSTRAINT_UNIQUE 
Op_RESULT_CONSTRAINT_NONEMPTY 
Op_NOP 

Member Function Documentation

static ArgumentIndex _Wolframe::db::vm::InstructionSet::argumentIndex ( const Instruction instr)
inlinestatic

Get the argument index of the instruction (addressing the argument depending on the argument type of the instruction)

param[in] instr the instruction to extract the argument index from

static ArgumentType _Wolframe::db::vm::InstructionSet::argumentType ( OpCode  i)
inlinestatic

get the argument type of an operation

static const char* _Wolframe::db::vm::InstructionSet::argumentTypeName ( ArgumentType  i)
inlinestatic

Get the name of an argument type.

static CondCode _Wolframe::db::vm::InstructionSet::condCode ( const Instruction instr)
inlinestatic

Get the condition code of an instruction (defining on which condition the instruction is executed)

param[in] instr the instruction to extract the condition code from

static const char* _Wolframe::db::vm::InstructionSet::condCodeName ( CondCode  i)
inlinestatic

Get the name of a conditional code.

static Instruction _Wolframe::db::vm::InstructionSet::instruction ( CondCode  cond,
OpCode  opcode,
unsigned int  arg = 0 
)
inlinestatic

Build an instruction from its parts.

param[in] cond conditional code (condition for execution) param[in] opcode instruction operation code param[in] arg operation argument

Returns
the instruction
static Instruction _Wolframe::db::vm::InstructionSet::instruction ( OpCode  opcode,
unsigned int  arg = 0 
)
inlinestatic

Build an instruction from its parts (no condition -> always executed)

param[in] opcode instruction operation code param[in] arg operation argument

Returns
the instruction
static std::string _Wolframe::db::vm::InstructionSet::instructionstr ( const Instruction instr)
inlinestatic

Get the instruction as string.

Returns
the instruction as string
static OpCode _Wolframe::db::vm::InstructionSet::opCode ( const Instruction instr)
inlinestatic

Get the operation code of an instruction (defining what is done on execution)

param[in] instr the instruction to extract the operation code from

static const char* _Wolframe::db::vm::InstructionSet::opCodeName ( OpCode  i)
inlinestatic
static void _Wolframe::db::vm::InstructionSet::printProgramRaw ( std::ostream &  out,
const std::vector< Instruction > &  prg 
)
inlinestatic

Print the program code without any symbolic information that is not available here.

param[out] out output stream to print to param[out] prg vector of instructions to print


The documentation for this class was generated from the following file: