Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Compiler_Bytecode_Execution_Result Struct Reference

Result of one bytecode execution request. More...

#include <Bytecode_Interpreter.H>

Collaboration diagram for Aleph::Compiler_Bytecode_Execution_Result:
[legend]

Public Member Functions

bool ok () const noexcept
 Returns whether execution completed without runtime errors.
 

Static Public Member Functions

static Compiler_Bytecode_Execution_Result returned (const Compiler_Bytecode_Value &value, const size_t executed_instructions)
 Builds a successful return result.
 
static Compiler_Bytecode_Execution_Result halted (const Compiler_Bytecode_Value &value, const size_t executed_instructions)
 Builds a successful halt result.
 
static Compiler_Bytecode_Execution_Result runtime_error (const Compiler_Bytecode_Runtime_Error &error, const size_t executed_instructions)
 Builds a failed runtime result.
 

Public Attributes

Compiler_Bytecode_Completion_Kind kind = Compiler_Bytecode_Completion_Kind::Halted
 Final completion category.
 
Compiler_Bytecode_Value value = Compiler_Bytecode_Value::make_unit()
 Produced return value or final Unit.
 
Compiler_Bytecode_Runtime_Error error
 Structured failure when kind == Runtime_Error.
 
size_t executed_instructions = 0
 Number of bytecode instructions observed by the VM.
 

Detailed Description

Result of one bytecode execution request.

Definition at line 262 of file Bytecode_Interpreter.H.

Member Function Documentation

◆ halted()

static Compiler_Bytecode_Execution_Result Aleph::Compiler_Bytecode_Execution_Result::halted ( const Compiler_Bytecode_Value &  value,
const size_t  executed_instructions 
)
inlinestatic

◆ ok()

bool Aleph::Compiler_Bytecode_Execution_Result::ok ( ) const
inlinenoexcept

Returns whether execution completed without runtime errors.

Definition at line 271 of file Bytecode_Interpreter.H.

References kind, and Aleph::Runtime_Error.

Referenced by Aleph::Compiler_Bytecode_VM::execute_loop().

◆ returned()

static Compiler_Bytecode_Execution_Result Aleph::Compiler_Bytecode_Execution_Result::returned ( const Compiler_Bytecode_Value &  value,
const size_t  executed_instructions 
)
inlinestatic

Builds a successful return result.

Definition at line 278 of file Bytecode_Interpreter.H.

References executed_instructions, kind, Aleph::Returned, and value.

Referenced by Aleph::Compiler_Bytecode_VM::complete_current_frame().

◆ runtime_error()

static Compiler_Bytecode_Execution_Result Aleph::Compiler_Bytecode_Execution_Result::runtime_error ( const Compiler_Bytecode_Runtime_Error &  error,
const size_t  executed_instructions 
)
inlinestatic

Member Data Documentation

◆ error

Compiler_Bytecode_Runtime_Error Aleph::Compiler_Bytecode_Execution_Result::error

Structured failure when kind == Runtime_Error.

Definition at line 266 of file Bytecode_Interpreter.H.

Referenced by Aleph::Compiler_Bytecode_VM::execute_host_call(), and runtime_error().

◆ executed_instructions

size_t Aleph::Compiler_Bytecode_Execution_Result::executed_instructions = 0

Number of bytecode instructions observed by the VM.

Definition at line 267 of file Bytecode_Interpreter.H.

Referenced by halted(), returned(), and runtime_error().

◆ kind

Compiler_Bytecode_Completion_Kind Aleph::Compiler_Bytecode_Execution_Result::kind = Compiler_Bytecode_Completion_Kind::Halted

Final completion category.

Definition at line 264 of file Bytecode_Interpreter.H.

Referenced by halted(), ok(), returned(), and runtime_error().

◆ value

Compiler_Bytecode_Value Aleph::Compiler_Bytecode_Execution_Result::value = Compiler_Bytecode_Value::make_unit()

Produced return value or final Unit.

Definition at line 265 of file Bytecode_Interpreter.H.

Referenced by halted(), returned(), and runtime_error().


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