Skip to main content

Crate praxis_runtime

Crate praxis_runtime 

Source
Expand description

Runtime heap, type descriptors, and runtime context for Praxis.

This crate is the contract between JIT-generated code and the Rust runtime, and it holds the GC implementation.

  • Every language value is a uniform GcRef (§4.3, §11.1).
  • Every generated function follows fn(RuntimeContext*, GcRef...) -> GcRef (§10.3).
  • Runtime wrappers never let a Rust panic unwind across the ABI (§9.2); they set pending_fault and return a defined sentinel instead.
  • A TypeDescriptor centralizes every operation on a value’s payload (§11.4), so the compiler never has to scatter type switches.
  • A precise, non-moving mark-and-sweep collector reclaims unreachable objects (§12.1, ADR-011).

See docs/technical-design.md §11, §12, and Appendix B.

Re-exports§

pub use abi::RUNTIME_ABI_VERSION;
pub use abi::assert_abi_version;
pub use breakpoint::BreakpointHandler;
pub use breakpoint::BreakpointStop;
pub use breakpoint::Resume;
pub use breakpoint::breakpoints_detached;
pub use breakpoint::clear_breakpoint_handler;
pub use breakpoint::install_breakpoint_handler;
pub use closures::ClosurePayload;
pub use collections::DequePayload;
pub use collections::GridPayload;
pub use collections::VecPayload;
pub use context::DebugLocal;
pub use context::FRAME_BYTES_BASE;
pub use context::FRAME_BYTES_PER_SLOT;
pub use context::Fault;
pub use context::FaultKind;
pub use context::FaultMessage;
pub use context::MAX_RECURSION_DEPTH;
pub use context::REFERENCE_FRAME_SLOTS;
pub use context::Runtime;
pub use context::RuntimeContext;
pub use context::STACK_BUDGET_BYTES;
pub use context::StackBudget;
pub use context::current_fault_kind;
pub use context::frame_cost;
pub use crash_snapshot::CrashSnapshot;
pub use crash_snapshot::SnapshotFrame;
pub use crash_snapshot::SnapshotSlot;
pub use debug::DebugFrameEntry;
pub use debug::DebugFrameStack;
pub use debug::DebugFrameStackHeader;
pub use debug::DebugLocalMeta;
pub use debug::DebugSlotKind;
pub use debug::DebugValue;
pub use debug::DebugValueStack;
pub use debug::DebugValueStackHeader;
pub use debug::FunctionDebugMeta;
pub use debug::LOCAL_KIND_TEMP;
pub use debug::LOCAL_KIND_USER;
pub use debug::ScalarValue;
pub use descriptor::BUILTINS;
pub use descriptor::BuiltinTypeId;
pub use descriptor::CompareFn;
pub use descriptor::DropFn;
pub use descriptor::DynamicHasher;
pub use descriptor::EqualsFn;
pub use descriptor::FormatFn;
pub use descriptor::FormatSink;
pub use descriptor::FormatStyle;
pub use descriptor::HashFn;
pub use descriptor::StructHasher;
pub use descriptor::TraceFn;
pub use descriptor::Tracer;
pub use descriptor::TypeDescriptor;
pub use descriptor::TypeId;
pub use gc::GcHeader;
pub use gc::GcRef;
pub use gc::HeapId;
pub use heap::Heap;
pub use heap::HeapStats;
pub use heap::INITIAL_COLLECT_THRESHOLD;
pub use heap::InlineClaimSite;
pub use heap::InlineInternSite;
pub use heap::LIVE_HEADROOM;
pub use heap::MAX_COLLECT_THRESHOLD;
pub use heap::Pacer;
pub use immortal::Immortals;
pub use input::InputReader;
pub use input::clear_input_reader;
pub use input::install_input_reader;
pub use parse_detail::ParseDetail;
pub use parse_detail::ParseFail;
pub use records::RecordField;
pub use records::RecordPayload;
pub use records::RecordSchema;
pub use records::SchemaIdentity;
pub use repr::InstanceArg;
pub use repr::InstanceRepr;
pub use repr::instance_repr;
pub use repr_c_vec::ReprCVec;
pub use repr_c_vec::VecMut;
pub use roots::NATIVE_ROOT_RESERVATION;
pub use roots::NativeRootStore;
pub use roots::NativeScope;
pub use roots::RootScope;
pub use roots::RootSet;
pub use roots::Rooted;
pub use roots::RuntimeRoots;
pub use shadow_stack::DebugSlotCount;
pub use shadow_stack::MAX_DEBUG_VALUE_SLOTS;
pub use shadow_stack::MAX_SHADOW_SLOTS;
pub use shadow_stack::SHADOW_STACK_SLOTS;
pub use shadow_stack::ShadowFrameGuard;
pub use shadow_stack::ShadowStack;
pub use shadow_stack::ShadowStackHeader;
pub use shadow_stack::SlotCount;
pub use shadow_stack::SlotStack;
pub use shadow_stack::SlotStackHeader;
pub use shadow_stack::push_frame;
pub use small_int::SMALL_INT_COUNT;
pub use small_int::SMALL_INT_MAX;
pub use small_int::SMALL_INT_MIN;
pub use small_int::SMALL_INT_STRIDE;
pub use small_int::index_of as small_int_index;
pub use teardown::HeapDrained;
pub use teardown::retire_parser_plans;
pub use text::TextPayload;
pub use tuples::TuplePayload;
pub use tuples::TupleSchema;

Modules§

abi
Runtime ABI versioning (§11.6) and the praxis_* extern wrappers (§10.2, §10.4, §11.1) that JIT-generated code calls.
bitset
BitSet (§6.1).
breakpoint
Breakpoint stops: what a :bp marker does at runtime (§9.8).
closures
The Closure value descriptor (§4.10).
collections
The Vec[T] collection descriptor (§11.2, ADR-013).
context
The RuntimeContext handed to every generated function (§10.3, Appendix B) and the Runtime that owns the heap + immortals.
crash_snapshot
Crash snapshots: a stable, deep-copied view of the debug frames taken at the moment a fault begins to unwind (§9.3).
debug
Crash-debugger frame registration (§9.3, ADR-021, ADR-104).
descriptor
Type descriptors: the vtable-equivalent for runtime objects (§11.4).
dynamic_key
The DynamicKey wrapper for hash-based collections (§11.3).
enums
The Enum value descriptor (§4.6).
gc
The uniform object reference type and its header.
graph
The graph walks behind §6.5’s prelude helpers (ADR-060).
heap
The GC heap and the precise non-moving mark-and-sweep collector (§12, ADR-011, ADR-103).
heaps
MinHeap[T] and MaxHeap[T] (§6.1, §11.2).
immortal
Immortal singleton objects (§4.3).
input
The process input buffer, read on first use (§7.1, §7.10).
maps
Map[K, V], Set[T], and Counter[T] (§6.1, §11.3).
parse_detail
Rich parse-failure detail (§7.11).
parser
The runtime input-parser interpreter (§7).
range
Range (§4.11, ADR-059).
records
The Record descriptor (§7.8).
repr
What a live value records about its own type.
repr_c_vec
ReprCVec<T> — a growable vector whose field layout is a promise (ADR-118).
roots
Explicit root frames (§12.3, ADR-012) and the composite runtime root set.
scalars
Built-in scalar type descriptors (§4.3, §11.4).
shadow_stack
The compiler-managed shadow stack (§12.3, ADR-019, ADR-101).
small_char
The interned ASCII Char range (§4.3, ADR-107).
small_int
The interned small-Int range (§4.3).
teardown
The teardown proof that gates generation reclamation.
text
The Text scalar descriptor (§4.3, ADR-013).
tuples
The Tuple value descriptor (§4.5 structural tuples).
var_cell
The VarCell value descriptor (§4.10).