|
runtime 1.1.4
Checked CEL programs, owned values, and reusable execution stacks
|
A move-only handle to immutable frozen code and its captures. More...
#include <cel/runtime/dyn_segment.hpp>
Public Member Functions | |
| compiled_segment (const compiled_segment &)=delete | |
| compiled_segment & | operator= (const compiled_segment &)=delete |
| 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. | |
| const value_type & | result_type () const noexcept |
| Returns the complete frozen result descriptor. | |
| const stack_requirements & | requirements () const noexcept |
| Borrows frozen intermediate alignment, peak canonical extent, and live-slot depth. | |
| value | execute (raw_stack &stack, std::span< const value > arguments) const |
| Executes checked positional inputs and returns one independent result owner. | |
| template<class R, class... Args> | |
| prepared_segment< R, Args... > | prepare () const |
| Binds exact recursive concrete adapters once, admitting valid client leaves at roots. | |
Friends | |
| class | dyn_segment |
| struct | detail::segment_access |
A move-only handle to immutable frozen code and its captures.
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>();.
| value cel::compiled_segment::execute | ( | raw_stack & | stack, |
| std::span< const value > | arguments ) const |
Executes checked positional inputs and returns one independent result owner.
Validates every emitted read before effects. Extra unused inputs are permitted and are not materialized. Borrows arguments for the call. Preserves the caller's stack prefix, not external callback effects. Returned callable components retain reference-semantic code.
Throws std::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.
Complexity: O(read validation + executed instructions + payload work) time and result space.
Example: auto result = program.execute(stack, inputs);.
|
defaultnoexcept |
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).
|
noexcept |
Borrows frozen intermediate alignment, peak canonical extent, and live-slot depth.
Arbitrary callback/nested costs are not inferred; use for_prefix before reserving.
Example: auto r = program.requirements().for_prefix(stack.cursor(), stack.depth());.
|
noexcept |
Returns the complete frozen result descriptor.
The reference borrows retained code; copying the descriptor retains its metadata.
Example: auto type = program.result_type();.