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

Arena-backed ownership context for bytecode functions and modules. More...

#include <Bytecode.H>

Collaboration diagram for Aleph::Compiler_Bytecode_Context:
[legend]

Classes

struct  Owned_Object
 

Public Member Functions

 Compiler_Bytecode_Context (const size_t arena_size=AhArenaAllocator::DEFAULT_SIZE)
 Constructs a bytecode context.
 
 Compiler_Bytecode_Context (const Compiler_Bytecode_Context &)=delete
 
Compiler_Bytecode_Context & operator= (const Compiler_Bytecode_Context &)=delete
 
 ~Compiler_Bytecode_Context () noexcept
 Destroys all tracked objects and rewinds the arena.
 
template<typename T , typename... Args>
T * make (Args &&... args)
 Allocates and constructs one bytecode object in the arena.
 
void reset () noexcept
 Resets the arena and destroys all tracked objects.
 

Private Attributes

AhArenaAllocator arena
 
DynArray< Owned_Object > owned
 

Detailed Description

Arena-backed ownership context for bytecode functions and modules.

Definition at line 253 of file Bytecode.H.

Constructor & Destructor Documentation

◆ Compiler_Bytecode_Context() [1/2]

Aleph::Compiler_Bytecode_Context::Compiler_Bytecode_Context ( const size_t  arena_size = AhArenaAllocator::DEFAULT_SIZE)
inlineexplicit

Constructs a bytecode context.

Definition at line 266 of file Bytecode.H.

◆ Compiler_Bytecode_Context() [2/2]

Aleph::Compiler_Bytecode_Context::Compiler_Bytecode_Context ( const Compiler_Bytecode_Context &  )
delete

◆ ~Compiler_Bytecode_Context()

Aleph::Compiler_Bytecode_Context::~Compiler_Bytecode_Context ( )
inlinenoexcept

Destroys all tracked objects and rewinds the arena.

Definition at line 274 of file Bytecode.H.

References reset().

Member Function Documentation

◆ make()

template<typename T , typename... Args>
T * Aleph::Compiler_Bytecode_Context::make ( Args &&...  args)
inline

Allocates and constructs one bytecode object in the arena.

Definition at line 281 of file Bytecode.H.

References ah_runtime_error_unless, arena, Aleph::blossom_maximum_cardinality_matching(), and owned.

Referenced by Aleph::Compiler_Bytecode_Lowering::lower_function(), and Aleph::Compiler_Bytecode_Lowering::lower_module().

◆ operator=()

Compiler_Bytecode_Context & Aleph::Compiler_Bytecode_Context::operator= ( const Compiler_Bytecode_Context &  )
delete

◆ reset()

void Aleph::Compiler_Bytecode_Context::reset ( )
inlinenoexcept

Resets the arena and destroys all tracked objects.

Definition at line 298 of file Bytecode.H.

References Aleph::and, arena, owned, and Aleph::AhArenaAllocator::reset().

Referenced by ~Compiler_Bytecode_Context(), Aleph::Compiler_Driver::clear(), and Aleph::Compiler_Generic_Driver::clear().

Member Data Documentation

◆ arena

AhArenaAllocator Aleph::Compiler_Bytecode_Context::arena
private

Definition at line 261 of file Bytecode.H.

Referenced by make(), and reset().

◆ owned

DynArray<Owned_Object> Aleph::Compiler_Bytecode_Context::owned
private

Definition at line 262 of file Bytecode.H.

Referenced by make(), and reset().


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