runtime 1.0.0
Checked CEL programs, owned values, and reusable execution stacks
Loading...
Searching...
No Matches
cel Namespace Reference

Provides byte extents for stack reservation and type descriptors. More...

Classes

class  callable
 Owns a reference-semantic handle to frozen code and its complete declared signature. Copies share code, explicit callback references, and the same-carrier entry guard. There is no implicit lexical environment or shared invocation argument/result table. Exclusive access is required; recursive entry into the same carrier throws logic_error. Distinct carriers can nest on the caller's stack. Callback references stay caller-owned. Moves between distinct handles leave the source without code; assign a live handle before using source's borrowed accessors. Borrowed signatures and requirements remain valid while an unchanged live handle retains their code. Last ownership retires runtime-managed executable graphs without allocation or recursive descent, including callable literals and lazy bodies. Client destructors retain their costs. More...
class  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...
class  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...
struct  layout
 Describes a byte extent and its requested alignment, both in bytes. A checked storage operation accepts a zero size but requires a nonzero power-of-two alignment. The fields describe storage, not initialized objects or their ownership. Example: cel::layout leaf{sizeof(double), alignof(double)};. More...
class  prepared_segment
 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...
class  raw_stack
 Owns reusable canonical operand bytes and complete live-slot metadata. The owner outlives every borrowed frame. Moving rejects active frames. Exclusive access is required, including during nested evaluation. During canonical construction, operand acquisition, or retirement, reentrant mutation, extraction, execution, and frame entry throw std::logic_error. Ordinary operation callbacks may use the active frame or evaluate a nested frame. Example: raw_stack s; s.reserve(256, 256); s.push(2.0); auto n = s.pop<double>();. More...
struct  record_field
 Supplies a source-order name/type pair to value_type::record, which validates its name. Example: record_field{"enabled", value_type::leaf<bool>()}. More...
struct  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...
struct  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...
struct  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...
class  value
 Owns a complete runtime value; copies own independent mutable payloads. Installed callables are explicit reference-semantic code handles: copies share frozen code, callback references, and the carrier's recursive-entry guard, not mutable aggregate payloads. Moved-from and default values are source unit. Internal descriptors may be shared. Opaque leaves own their bytes, not objects reachable through client pointers. Composite admission rejects incompatible opaque ownership operations even for equal shapes. Example: auto number = value::from(2.0); auto copy = number;. More...
class  value_type
 Shares an immutable, complete semantic type and canonical byte layout. Leaf identity is concrete C++ type identity; records additionally retain their nominal identity and field names. Capabilities do not change semantic identity. Copies share immutable metadata, never mutable value payloads. Borrowed references, spans, and string views remain valid while a descriptor retaining their metadata remains alive. Keep this descriptor unchanged while using its views. Factories retain component descriptors and copy supplied names; input spans and strings need not outlive construction. See the example for value for record construction. Example: auto numbers = value_type::array(value_type::leaf<double>());. More...

Enumerations

enum class  range_kind {
  range_kind::range , range_kind::range_from , range_kind::range_to , range_kind::range_to_inclusive ,
  range_kind::range_inclusive , range_kind::range_full
}
 Identifies every source range form independently of its endpoint layout. Example: range_kind::range_inclusive describes start..=end. More...
enum class  type_kind {
  type_kind::leaf , type_kind::array , type_kind::tuple , type_kind::record ,
  type_kind::range , type_kind::callable
}
 Identifies a descriptor's structural category. Example: an empty source unit has type_kind::tuple. More...

Functions

bool 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 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 T>
value_type native_type ()
 Returns the runtime's complete descriptor for a trusted native value type. Removes cv/reference qualifiers; leaves must be trivially copyable. Tuples and vectors use canonical structural adapters, not native object layouts. Complexity: O(distinct descriptor nodes and fields) on first use, O(1) thereafter. Example: auto type = native_type<std::vector<std::tuple<bool, double>>>();.
value_type bind_runtime_ownership (const value_type &type)
 Returns a runtime ownership-capable witness for the complete immutable type graph. Preserves semantic identity, layout, names, ordering, parameter admission, and results. Binds deferred callables, including nested results, to the runtime's canonical carrier operations; retains already installed canonical ownership and shares unchanged metadata. The input remains unchanged. Binding creates no live callable, body, or initialized bytes and invokes no ownership operations. Repeated binding is representation-compatible. Throws std::invalid_argument for foreign or incompatible installed callable operations anywhere in the graph. Allocation failures propagate without changing the input. Complexity: expected O(V + E + S) time and auxiliary space for V distinct metadata nodes, E edges, and S copied name bytes; traversal and cleanup use no native recursion. Example (with <cel/runtime.hpp>):

Detailed Description

Provides byte extents for stack reservation and type descriptors.