|
runtime 1.0.0
Checked CEL programs, owned values, and reusable execution stacks
|
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...
#include <cel/runtime/dyn_segment.hpp>
Public Member Functions | |
| compiled_segment (const compiled_segment &)=delete | |
| Disallows misleading independent capture copies. | |
| compiled_segment & | operator= (const compiled_segment &)=delete |
| Disallows copied assignment. | |
| compiled_segment (compiled_segment &&) noexcept=default | |
| Transfers the frozen handle. | |
| compiled_segment & | operator= (compiled_segment &&) noexcept=default |
| Transfers the handle and releases prior code when uniquely owned. Self-move leaves this handle unchanged. Complexity: O(prior captures and metadata on last release). | |
| const value_type & | result_type () const noexcept |
| Returns the complete frozen result descriptor. The reference borrows retained code; copying the descriptor retains its metadata. Precondition: this handle has not been moved from. Example: auto type = program.result_type();. | |
| const stack_requirements & | requirements () const noexcept |
| Borrows frozen intermediate alignment, peak canonical extent, and live-slot depth. Precondition: this handle has not been moved from. Arbitrary callback/nested costs are not inferred; use for_prefix before reserving. Example: auto r = program.requirements().for_prefix(stack.cursor(), stack.depth());. | |
| value | execute (raw_stack &stack, std::span< const value > arguments) const |
| Validates all actual read witnesses before effects and returns an independent owner. Extra unused inputs are permitted and are not materialized. Borrows arguments for the call; callbacks must not mutate their owners or owned payloads. Throws invalid_argument for dependent origin or missing/incompatible read types/ownership. Throws std::logic_error for a moved-from handle or canonical-phase stack reentry. Callback/acquisition exceptions propagate after nonallocating suffix cleanup. Preserves the caller's stack prefix, not external callback effects. Returned callable components retain reference-semantic code. Complexity: O(read validation + executed instructions + payload work) time and result space. Example: auto result = program.execute(stack, inputs);. | |
| template<class R, class... Args> | |
| prepared_segment< R, Args... > | 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>();. | |
Friends | |
| class | dyn_segment |
| struct | detail::segment_access |
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>();.