|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Arena-backed ownership context for HIR nodes. More...
#include <Compiler_HIR_Model.H>
Classes | |
| struct | Owned_Object |
Public Member Functions | |
| Compiler_HIR_Context (const size_t arena_size=AhArenaAllocator::DEFAULT_SIZE) | |
Constructs a context with arena_size bytes. | |
| Compiler_HIR_Context (const Compiler_HIR_Context &)=delete | |
| Compiler_HIR_Context & | operator= (const Compiler_HIR_Context &)=delete |
| ~Compiler_HIR_Context () noexcept | |
| template<typename T , typename... Args> | |
| T * | make (Args &&...args) |
| Allocates and constructs one HIR object. | |
| void | reset () noexcept |
| Destroys all tracked objects and rewinds the arena. | |
| size_t | allocated_size () const noexcept |
| Returns bytes currently consumed in the arena. | |
| size_t | capacity () const noexcept |
| Returns total arena capacity in bytes. | |
Private Attributes | |
| AhArenaAllocator | arena |
| DynArray< Owned_Object > | owned |
Arena-backed ownership context for HIR nodes.
Definition at line 186 of file Compiler_HIR_Model.H.
|
inlineexplicit |
Constructs a context with arena_size bytes.
| arena_size | Arena capacity in bytes. |
| std::runtime_error | If the arena cannot be created. |
Definition at line 203 of file Compiler_HIR_Model.H.
|
delete |
|
inlinenoexcept |
Definition at line 210 of file Compiler_HIR_Model.H.
References reset().
|
inlinenoexcept |
Returns bytes currently consumed in the arena.
Definition at line 250 of file Compiler_HIR_Model.H.
References Aleph::AhArenaAllocator::allocated_size(), and arena.
|
inlinenoexcept |
Returns total arena capacity in bytes.
Definition at line 256 of file Compiler_HIR_Model.H.
References arena, and Aleph::AhArenaAllocator::capacity().
Allocates and constructs one HIR object.
| T | Object type to create. |
| args | Constructor arguments forwarded to T. |
reset() or destruction. | std::runtime_error | If arena allocation fails. |
Definition at line 223 of file Compiler_HIR_Model.H.
References ah_runtime_error_unless, arena, Aleph::blossom_maximum_cardinality_matching(), and owned.
Referenced by Aleph::Compiler_HIR_Lowering::lower_expr(), Aleph::Compiler_HIR_Lowering::lower_function(), Aleph::Compiler_HIR_Lowering::lower_module(), and Aleph::Compiler_HIR_Lowering::lower_stmt().
|
delete |
|
inlinenoexcept |
Destroys all tracked objects and rewinds the arena.
Definition at line 237 of file Compiler_HIR_Model.H.
References Aleph::and, arena, owned, and Aleph::AhArenaAllocator::reset().
Referenced by ~Compiler_HIR_Context(), Aleph::Compiler_Driver::clear(), Aleph::Compiler_Line_Frontend::clear(), and Aleph::Compiler_MVP_Frontend::clear().
|
private |
Definition at line 194 of file Compiler_HIR_Model.H.
Referenced by allocated_size(), capacity(), make(), and reset().
|
private |
Definition at line 195 of file Compiler_HIR_Model.H.