A command of the VM.
Definition at line 23 of file virtualmachine.hpp.
#include <virtualmachine.hpp>
Inner Type Index: | |
| struct | DbgInformation |
| union | OperationParam |
| A union of different parameter types for the commands. More... | |
Public Type Index: | |
| enum | Bits { CMD_MASK = 0x07 , FlagEOC = 0x08 , CMD_MASK_WITH_EOC = 0x0F , TYPE_MASK = 0xF0 } |
| Some meanings and masks of the field bits. More... | |
| enum class | JumpType { Conditional , Unconditional } |
| Denotes the two different jump types (used only as parameter, not stored.). More... | |
| enum | ListingTypes { LiteralConstant = 0x00 , OptimizationConstant = 0x10 , UnaryOp = 0x20 , BinaryOp = 0x30 , Identifier = 0x40 , FunctionCall = 0x50 , AutoCast = 0x60 , NestedExpression = 0x70 } |
| Denotes the type of parsing de-compilation information attached to the command. More... | |
| enum | OpCodes { Constant = 0 , Function = 1 , Subroutine = 2 , JumpIfFalse = 4 , Jump = 5 } |
| The opcode type of VM commands. More... | |
Public Field Index: | |
| DbgInformation | DbgInfo |
| Operation code of this command. Available only with debug-builds. | |
| String | DecompileSymbol |
| uinteger | ExpressionPositions |
| OperationParam | Parameter |
| The parameter of the operation. | |
| Box | ResultType |
Public Method Index: | |
| Command (CallbackDecl callback, bool isIdentifier, int qtyFunctionArgs, const Box &resultType, const String &functionOrOp, bool isOperator, integer idxOriginal, integer idxNormalized) | |
| Command (const Box &value, bool isOptimization, integer idxOriginal, integer idxNormalized) | |
| Command (integer idxOriginal, integer idxNormalized, JumpType jumpType) | |
| Command (Program *program, const Box &resultType, const String &functionOrOp, integer idxOriginal, integer idxNormalized) | |
| bool | HasArgs () const |
| bool | IsConstant () const |
| bool | IsIdentifier () const |
| bool | IsJump () const |
| constexpr OpCodes | OpCode () const |
| int | QtyArgs () const |
| void | SetEndOfConditionalFlag () |
| Marks the command as the end of a conditional term. | |
| constexpr ListingTypes | TerminalType () const |
Protected Field Index: | |
| int16_t | bits |
| Operation code of this command. | |
| uint16_t | qtyArgs |
Some meanings and masks of the field bits.
Definition at line 26 of file virtualmachine.hpp.
|
strong |
Denotes the two different jump types (used only as parameter, not stored.).
| Enumerator | |
|---|---|
| Conditional | Denotes |
| Unconditional | Denotes |
Definition at line 58 of file virtualmachine.hpp.
Denotes the type of parsing de-compilation information attached to the command.
Definition at line 46 of file virtualmachine.hpp.
The opcode type of VM commands.
| Enumerator | |
|---|---|
| Constant | Pushes a constant to the stack. |
| Function | Invokes a C++ callback function. |
| Subroutine | Invokes another program. |
| JumpIfFalse | Jumps if top of the stack indicates |
| Jump | Jumps. |
Definition at line 35 of file virtualmachine.hpp.
|
protected |
Operation code of this command.
Definition at line 101 of file virtualmachine.hpp.
| DbgInformation alib::expressions::detail::VirtualMachine::Command::DbgInfo |
Operation code of this command. Available only with debug-builds.
Definition at line 132 of file virtualmachine.hpp.
| String alib::expressions::detail::VirtualMachine::Command::DecompileSymbol |
The operator symbol or function name used with de-compilation to recreate an expression string.
Definition at line 127 of file virtualmachine.hpp.
| uinteger alib::expressions::detail::VirtualMachine::Command::ExpressionPositions |
This encodes both, the position in the original and in the normalized expression string that resulted in this command. Used for generation of exception information and debug listings.
Definition at line 122 of file virtualmachine.hpp.
| OperationParam alib::expressions::detail::VirtualMachine::Command::Parameter |
The parameter of the operation.
Definition at line 113 of file virtualmachine.hpp.
|
protected |
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 differentiating between 0 and a negative number of arguments) is used when decompiling a program back to an expression string. Hence, this piece of it logically belongs to ListingTypes.
Definition at line 109 of file virtualmachine.hpp.
| Box alib::expressions::detail::VirtualMachine::Command::ResultType |
With every command, this box contains the result type. For constants, also the commands' value is contained.
Definition at line 117 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 141 of file virtualmachine.hpp.
|
inline |
Constructor creating a native function call exposed from an identifier, function or operator.
| callback | The callback function. |
| isIdentifier | If no parentheses were given, this has to be true. Otherwise it is a function call. |
| 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 de-compilation 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 164 of file virtualmachine.hpp.
| alib::expressions::detail::VirtualMachine::Command::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 5 of file virtualmachine.cpp.
|
inline |
Constructor creating a jump. Note, the address is usually not known yet, hence not provided.
| jumpType | The type of jump. |
| idxOriginal | Expression string index that imposed command. |
| idxNormalized | Normalized expression string index that imposed command. |
Definition at line 195 of file virtualmachine.hpp.
|
inline |
true if the function has arguments, false otherwise. Definition at line 225 of file virtualmachine.hpp.
|
inline |
Returns true if the command represents a constant value, but is not the end of a conditional jump.
true if the command represents a constant value, false otherwise. Definition at line 214 of file virtualmachine.hpp.
|
inline |
true if the function has arguments, false otherwise. Definition at line 228 of file virtualmachine.hpp.
|
inline |
Returns true if the command represents a conditional or unconditional jump.
true if the command represents a jump, false otherwise. Definition at line 219 of file virtualmachine.hpp.
|
inlineconstexpr |
Returns the opcode of this command.
Definition at line 205 of file virtualmachine.hpp.
|
inline |
Definition at line 231 of file virtualmachine.hpp.
|
inline |
Marks the command as the end of a conditional term.
Definition at line 222 of file virtualmachine.hpp.
|
inlineconstexpr |
Returns the decompile type of this command.
Definition at line 209 of file virtualmachine.hpp.