runtime 1.1.4
Checked CEL programs, owned values, and reusable execution stacks
Loading...
Searching...
No Matches
cel::stack_requirements Struct Reference

The statically known storage requirements of a frozen ordinary program. More...

#include <cel/runtime/dyn_segment.hpp>

Public Member Functions

stack_reservation for_prefix (std::size_t cursor, std::size_t depth) const
 Returns checked conservative total capacities for an existing caller prefix.

Public Attributes

std::size_t alignment
 Gives maximum intermediate canonical alignment.
std::size_t frame_extent
 Gives peak canonical extent for a zero-cursor frame.
std::size_t live_slots
 Gives peak simultaneously live frame operands.

Detailed Description

The statically known storage requirements of a frozen ordinary program.

Extent and slots are peak simultaneous requirements, not cumulative instruction costs. Defaults to alignment one with no frame bytes or live slots. Composite payload allocations, concrete callback temporaries, and arbitrary callback or nested external stack work are not inferred. Result destinations remain caller-owned.

Example: auto r = program.requirements().for_prefix(stack.cursor(), stack.depth());.

Member Function Documentation

◆ for_prefix()

stack_reservation cel::stack_requirements::for_prefix ( std::size_t cursor,
std::size_t depth ) const

Returns checked conservative total capacities for an existing caller prefix.

Includes alignment padding and the live byte/depth prefix. Reserve before entering a frame, using cursor/depth measured without intervening mutation. raw_stack::reserve retains any higher existing alignment. Does not allocate or traverse type metadata.

Throws std::invalid_argument for invalid alignment and std::overflow_error if either total capacity is unrepresentable.

Example: auto r = requirements.for_prefix(stack.cursor(), stack.depth()); stack.reserve(r.bytes.size, r.bytes.alignment); stack.reserve_depth(r.slots);.


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