Bytecode interpreter execution engine.
More...
#include <interpreter_engine.h>
|
| std::unique_ptr< Impl > | impl_ |
Bytecode interpreter execution engine.
Wraps an ICPU and IMemory, loads the process's code segment into memory before each execution burst, and steps instruction-by-instruction up to the given tick budget. Reports results via ExecutionResult.
Usage:
auto result = engine.execute(process, 10);
Concrete CPU implementation.
InterpreterEngine(ICPU &cpu, IMemory &memory)
Constructs an InterpreterEngine.
Simulated physical RAM — a linear array of Block cells.
@ ProcessExited
Process executed Halt or Int Exit — normal termination.
Definition at line 35 of file interpreter_engine.h.
◆ InterpreterEngine() [1/3]
| contur::InterpreterEngine::InterpreterEngine |
( |
ICPU & | cpu, |
|
|
IMemory & | memory ) |
|
explicit |
Constructs an InterpreterEngine.
- Parameters
-
| cpu | Reference to the CPU (must outlive the engine). |
| memory | Reference to the memory subsystem (must outlive the engine). |
◆ ~InterpreterEngine()
| contur::InterpreterEngine::~InterpreterEngine |
( |
| ) |
|
|
override |
◆ InterpreterEngine() [2/3]
| contur::InterpreterEngine::InterpreterEngine |
( |
const InterpreterEngine & | | ) |
|
|
delete |
◆ InterpreterEngine() [3/3]
| contur::InterpreterEngine::InterpreterEngine |
( |
InterpreterEngine && | | ) |
|
|
noexcept |
◆ execute()
Executes the given process for up to tickBudget ticks.
The engine runs the process until one of:
- The tick budget is exhausted (preemption)
- The process exits (Halt / Int Exit)
- An error or interrupt occurs that requires kernel attention
- Parameters
-
| process | The process image to execute (registers + code). |
| tickBudget | Maximum number of ticks (instructions) to execute. |
- Returns
- An ExecutionResult describing the outcome.
Implements contur::IExecutionEngine.
◆ halt()
| void contur::InterpreterEngine::halt |
( |
ProcessId | pid | ) |
|
|
overridevirtual |
Forcibly halts execution of the given process.
- Parameters
-
| pid | The process ID to halt. |
Implements contur::IExecutionEngine.
◆ name()
| std::string_view contur::InterpreterEngine::name |
( |
| ) |
const |
|
nodiscardoverridevirtualnoexcept |
Returns the human-readable name of this engine.
- Returns
- "Interpreter" or "Native", etc.
Implements contur::IExecutionEngine.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ impl_
| std::unique_ptr<Impl> contur::InterpreterEngine::impl_ |
|
private |
The documentation for this class was generated from the following file: