A command of the VM.
Definition at line 46 of file virtualmachine.hpp.
#include <virtualmachine.hpp>
Inner Type Index: | |
struct | DbgInformation |
union | OperationParam |
Public Type Index: | |
enum class | DecompileInfoType { LiteralConstant , OptimizationConstant , UnaryOp , BinaryOp , Function , AutoCast , Subroutine } |
enum class | JumpType { Conditional , Unconditional } |
enum class | OpCodes { Constant = 1 , Function = 2 , JumpIfFalse = 3 , Jump = 4 , Subroutine = 5 , CmdMask = (1 << 16) - 1 , FlagEOC = (1 << 17) } |
Public Field Index: | |
DbgInformation | DbgInfo |
String | DecompileSymbol |
DecompileInfoType | DecompileType |
uinteger | ExpressionPositions |
OperationParam | Operation |
integer | QtyFunctionArgs |
Box | ResultType |
Public Method Index: | |
Command (CallbackDecl callback, integer qtyFunctionArgs, const Box &resultType, const String &functionOrOp, bool isOperator, integer idxOriginal, integer idxNormalized) | |
Command (const Box &value, bool isOptimization, integer idxOriginal, integer idxNormalized) | |
Command (JumpType jumpType, integer idxOriginal, integer idxNormalized) | |
Command (Program *program, const Box &resultType, const String &functionOrOp, integer idxOriginal, integer idxNormalized) | |
bool | IsConditionalJump () const |
bool | IsConstant () const |
void | SetEndOfConditionalFlag () |
OpCodes | Which () const |
|
strong |
Denotes the type of decompilation information attached to the command.
Enumerator | |
---|---|
LiteralConstant | Command results from a literal constant. |
OptimizationConstant | Command results from a constant resulting from an optimization. |
UnaryOp | Command results from an unary operator. |
BinaryOp | Command results from a binary operator. |
Function | Command results from a function call. |
AutoCast | Command results from an automatically inserted cast. |
Subroutine | Command results from a nested expression. |
Definition at line 80 of file virtualmachine.hpp.
|
strong |
Denotes the two different jump types (used as constructor parameter only.)
Enumerator | |
---|---|
Conditional | Denotes JumpIfFalse. |
Unconditional | Denotes Jump. |
Definition at line 70 of file virtualmachine.hpp.
|
strong |
The opcode type of VM commands. This is defined as a bitwise enum type as also flags may be set in addition to defining the type of operation.
Definition at line 54 of file virtualmachine.hpp.
DbgInformation DbgInfo |
Operation code of this command. Available only with debug builds.
Definition at line 195 of file virtualmachine.hpp.
String DecompileSymbol |
The operator symbol or function name used with decompilation to recreate an expression string.
Definition at line 190 of file virtualmachine.hpp.
DecompileInfoType DecompileType |
Type of expression term used with decompilation.
Definition at line 186 of file virtualmachine.hpp.
uinteger ExpressionPositions |
This encodes both, the position in the original and normalized expression string that resulted in this command. Used for generation of exception information and and debug listings.
Definition at line 182 of file virtualmachine.hpp.
|
protected |
Operation code of this command.
Definition at line 152 of file virtualmachine.hpp.
OperationParam Operation |
The parameter of the operation.
Definition at line 156 of file virtualmachine.hpp.
integer QtyFunctionArgs |
The number of function args. If negative, this indicates that the function name was given as an 'identifier', what means that no brackets '()' had been added. This piece of information (namely having a signed integer here which allows to differentiate between 0
and a negative number of arguments) is used when decompiling a program to back to an expression string. Hence, this piece of it logically belongs to DecompileType.
Definition at line 166 of file virtualmachine.hpp.
Box ResultType |
The result type of a command. This is only needed during compilation. With debug builds of the library, it is furthermore used with VirtualMachine::DbgList . Hence for simplicity and shortness of the library code we keep it here, taking into account that after compilation each command is equipped with a then unnecessary box.
Definition at line 175 of file virtualmachine.hpp.
|
inline |
Constructor creating a constant.
value | The constant to add. |
isOptimization | Denotes if the constant results from an optimization or from a literal of the expression string. |
idxOriginal | Expression string index that imposed command. |
idxNormalized | Normalized expression string index that imposed command. |
Definition at line 206 of file virtualmachine.hpp.
|
inline |
Constructor creating a native function call exposed from an identifier, function or operator.
callback | The callback function. |
qtyFunctionArgs | The number of arguments that the callback function expects. |
resultType | The result type of the function. |
functionOrOp | The identifier, function or operator name/symbol. This is used for decompilation of programs. |
isOperator | If true an unary operator was compiled, a binary operator otherwise. |
idxOriginal | Expression string index that imposed command. |
idxNormalized | Normalized expression string index that imposed command. |
Definition at line 231 of file virtualmachine.hpp.
Command | ( | Program * | program, |
const Box & | resultType, | ||
const String & | functionOrOp, | ||
integer | idxOriginal, | ||
integer | idxNormalized ) |
Constructor creating a subroutine call.
program | The program to call. |
resultType | The result type of the program. |
functionOrOp | The function or operator that created the nested call. |
idxOriginal | Expression string index that imposed command. |
idxNormalized | Normalized expression string index that imposed command. |
Definition at line 37 of file virtualmachine.cpp.
Constructor creating a jump. Note, the address is usually not known yet, hence not provided. With debug builds, this constructor asserts that it is used for jump commands only.
jumpType | The type of jump. |
idxOriginal | Expression string index that imposed command. |
idxNormalized | Normalized expression string index that imposed command. |
Definition at line 265 of file virtualmachine.hpp.
|
inline |
Returns true
if the command represents a jump.
true
if the command represents a jump, false
otherwise. Definition at line 288 of file virtualmachine.hpp.
|
inline |
Returns true
if the command represents a constant value.
true
if the command represents a constant value, false
otherwise. Definition at line 278 of file virtualmachine.hpp.
|
inline |
Marks the command as the end of an conditional term.
Definition at line 297 of file virtualmachine.hpp.
|
inline |
Returns the masked command part of the opcode.
Definition at line 306 of file virtualmachine.hpp.