A VM that is capable of executing a program with simple instructions on a stack of MemoryCells. More...
#include <RuleVM.h>
Classes | |
struct | Instruction |
An instruction to execute in the VM. More... | |
struct | Program |
A program that can be executed by this VM. More... | |
Public Types | |
enum | CMD { LOADC , LOADA , STOREA , RESERVE , LESS , GREATER , EQUAL , JUMPZERO , OUTPUTC , CONDOUTPUTC , HALT , AND , OR , POP , MUL , DIV , ADD , SUB , NOT } |
An enum with all commands that this VM supports. More... | |
using | MemoryCell = std::variant< bool, double, size_t, ContainerOption, TraversalOption, LoadEstimatorOption, DataLayoutOption, Newton3Option > |
The type of a memory cell in the stack the VM operates on. | |
Public Member Functions | |
std::vector< size_t > | execute (const Program &program, const std::vector< MemoryCell > &initialStack) |
Executes a program on a given initial stack. | |
A VM that is capable of executing a program with simple instructions on a stack of MemoryCells.
The result of the program is produced using a special output instruction CMD::OUTPUTC. A vector of numbers produced by executing these instructions is returned in the execute() method.
The VM is used to execute generated code by RuleBasedProgramTree. In this generated code, each configuration order is assigned a number. If this number is output using OUTPUTC, the configuration order should be applied in the current tuning phase.
enum autopas::RuleVM::CMD |
An enum with all commands that this VM supports.
|
inline |
Executes a program on a given initial stack.
program | The program to execute. |
initialStack | The stack to use when executing the program. (Can already contain some data). |