contur2
Loading...
Searching...
No Matches
contur::IExecutionEngine Class Referenceabstract

Abstract execution engine interface. More...

#include <i_execution_engine.h>

Inheritance diagram for contur::IExecutionEngine:

Public Member Functions

virtual ~IExecutionEngine ()=default
virtual ExecutionResult execute (ProcessImage &process, std::size_t tickBudget)=0
 Executes the given process for up to tickBudget ticks.
virtual void halt (ProcessId pid)=0
 Forcibly halts execution of the given process.
virtual std::string_view name () const noexcept=0
 Returns the human-readable name of this engine.

Protected Member Functions

 IExecutionEngine ()=default
 IExecutionEngine (const IExecutionEngine &)=default
IExecutionEngineoperator= (const IExecutionEngine &)=default
 IExecutionEngine (IExecutionEngine &&)=default
IExecutionEngineoperator= (IExecutionEngine &&)=default

Detailed Description

Abstract execution engine interface.

An execution engine takes a ProcessImage and runs it for up to tickBudget simulation ticks, returning an ExecutionResult that describes what happened (how many ticks were consumed, why execution stopped, etc.).

Implementations:

  • InterpreterEngine — fetches Block instructions from memory, decodes via CPU, executes step-by-step (educational, fully portable)
  • NativeEngine — wraps host OS process management (fork/exec on POSIX, CreateProcess on Windows)

Definition at line 33 of file i_execution_engine.h.

Constructor & Destructor Documentation

◆ ~IExecutionEngine()

virtual contur::IExecutionEngine::~IExecutionEngine ( )
virtualdefault

◆ IExecutionEngine() [1/3]

contur::IExecutionEngine::IExecutionEngine ( )
protecteddefault

◆ IExecutionEngine() [2/3]

contur::IExecutionEngine::IExecutionEngine ( const IExecutionEngine & )
protecteddefault

◆ IExecutionEngine() [3/3]

contur::IExecutionEngine::IExecutionEngine ( IExecutionEngine && )
protecteddefault

Member Function Documentation

◆ execute()

virtual ExecutionResult contur::IExecutionEngine::execute ( ProcessImage & process,
std::size_t tickBudget )
nodiscardpure virtual

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
processThe process image to execute (registers + code).
tickBudgetMaximum number of ticks (instructions) to execute.
Returns
An ExecutionResult describing the outcome.

Implemented in contur::InterpreterEngine.

◆ halt()

virtual void contur::IExecutionEngine::halt ( ProcessId pid)
pure virtual

Forcibly halts execution of the given process.

Parameters
pidThe process ID to halt.

Implemented in contur::InterpreterEngine.

◆ name()

virtual std::string_view contur::IExecutionEngine::name ( ) const
nodiscardpure virtualnoexcept

Returns the human-readable name of this engine.

Returns
"Interpreter" or "Native", etc.

Implemented in contur::InterpreterEngine.

◆ operator=() [1/2]

IExecutionEngine & contur::IExecutionEngine::operator= ( const IExecutionEngine & )
protecteddefault

◆ operator=() [2/2]

IExecutionEngine & contur::IExecutionEngine::operator= ( IExecutionEngine && )
protecteddefault

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