runtime 1.0.0
Checked CEL programs, owned values, and reusable execution stacks
Loading...
Searching...
No Matches
Programs and operations

Detailed Description

Build checked operations with cel::dyn_segment, freeze them as cel::compiled_segment, and bind typed repeated calls with cel::prepared_segment. See Compile and reuse a program and Add types and operations for examples.

Classes

struct  cel::stack_origin
 Identifies the byte cursor and live-slot depth below a fragment's local operands. Both coordinates must match; zero-byte prefixes still contribute live slots. Defaults to zero bytes and zero slots, the origin admitted for independent execution. Example: dyn_segment rhs(parent.before_top());. More...
class  cel::prepared_segment< R, Args >
 Borrows typed inputs and returns independent owning results through bound adapters. Leaves use direct addresses/result bytes; tuples/vectors use trusted canonical adapters. Composite conversion/result ownership may allocate; no recursive checks occur during calls. Handles share immutable engine state, not independent copies of mutable captures. After moving, use the source only for destruction or assignment, including after self-move. Destruction releases the binding and code. Complexity: last release takes O(released code nodes/edges + metadata + client destructor work). Example: auto result = bound.call(stack, 2.0);. See the runtime.hpp example for a complete typed call and stack reservation. More...
struct  cel::stack_reservation
 Describes total caller storage and slot capacity for one prefixed execution. Both fields include the live caller prefix; neither counts separately owned composite payloads. Example: stack.reserve(r.bytes.size, r.bytes.alignment); stack.reserve_depth(r.slots);. More...
struct  cel::stack_requirements
 Describes statically known canonical frame storage for 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());. More...
class  cel::dyn_segment
 Checks stack effects while constructing a move-only ordinary operation sequence. Operations consume older-first exact operands and report runtime failures with exceptions. Successful finish freezes captures and descriptors independently of builder lifetime. Owned callbacks retain their captures; referenced external state stays caller-owned. Destruction releases unfinished captures and metadata. Complexity: destruction takes O(owned captures, metadata, and client destructor work). Emission costs include amortized O(1) instruction bookkeeping and, on logical stack growth, O(current stack depth) metadata transfer in addition to each operation's stated costs. Example: dyn_segment b; b.just(value::from(2.0)); auto p = std::move(b).finish();. See the runtime.hpp example for complete construction, preparation, reservation, and execution. More...
class  cel::compiled_segment
 Retains immutable frozen code and its captures in a move-only handle. Prepared bindings and callables retain the code after this handle is destroyed. Captures are never copied as independent values; external referenced state stays caller-owned. Moves between distinct handles leave the source without code; assign a live handle before using borrowed accessors. Borrowed result types and requirements remain valid while unchanged code ownership retains them. Execution requires exclusive access to its stack and any mutable callback state. Last ownership retires managed captures and nested executable bodies without allocation or nesting-dependent stack. Arbitrary client capture destructors retain their own costs. Complexity: last release takes O(released code nodes/edges + metadata + client destructor work). Example: auto prepared = program.prepare<double, double>();. More...

Functions

bool cel::operator== (const stack_origin &left, const stack_origin &right) noexcept
 Compares both ambient coordinates exactly. Example: stack_origin{} == stack_origin{0, 0}.
template<class Signature, class F>
requires (detail::signature_binding<Signature, std::decay_t<F>>::available)
auto cel::with_signature (F &&callback)
 Selects an exact const callback member from an ambiguous or uninspectable overload set. Signature includes actual parameter and return reference qualifiers; no conversion creates a signature that the callback does not declare. The wrapper owns F normally. Generic callbacks that cannot prove their instantiated parameter identities use this explicit selection. Function pointers can instead be supplied directly with an exact cast. Complexity: O(callback construction) time and capture space. Example: builder.op1<double, double>(with_signature<double(double)>(overloaded{}));.
template<class R, class... Args>
prepared_segment< R, Args... > cel::compiled_segment::prepare () const
 Binds exact recursive concrete adapters once, admitting valid client leaves at roots. R must not be void; use std::tuple<> for a source-unit result. Unused declared arguments are accepted and are not converted during calls. Throws invalid_argument for incompatible argument/result shapes or undeclared reads. Throws invalid_argument for a dependent origin and logic_error for a moved-from handle. Complexity: O(arity + distinct compared metadata pairs) time and binding space. Example: auto bound = program.prepare<double, double>();.

Function Documentation

◆ prepare()

template<class R, class... Args>
prepared_segment< R, Args... > cel::compiled_segment::prepare ( ) const

Binds exact recursive concrete adapters once, admitting valid client leaves at roots. R must not be void; use std::tuple<> for a source-unit result. Unused declared arguments are accepted and are not converted during calls. Throws invalid_argument for incompatible argument/result shapes or undeclared reads. Throws invalid_argument for a dependent origin and logic_error for a moved-from handle. Complexity: O(arity + distinct compared metadata pairs) time and binding space. Example: auto bound = program.prepare<double, double>();.

Constructs exact adapter witnesses once before creating a typed binding.