Skip to main content

oxilean_runtime/
lib.rs

1//! # OxiLean Runtime -- Memory Management, Closures, I/O, and Scheduling
2//!
3//! This crate implements the runtime system for OxiLean.
4//! It provides:
5//!
6//! - Tagged pointer object system (object) - Core runtime value representation
7//! - Reference counting (rc) - Non-atomic and atomic RC with elision hints
8//! - Arena allocators (arena) - Bump allocation and region-based memory
9//! - Closure representation (closure) - Flat closures and partial application
10//! - I/O operations (io_runtime) - File, console, and string I/O
11//! - Task scheduler (scheduler) - Work-stealing parallel evaluation
12//! - Lazy evaluation with memoization (lazy_eval) - Call-by-need thunks and memo caches
13//! - Tail call optimization (tco) - Trampoline loop and TCO analysis
14//! - Rich evaluation errors (eval_error) - Structured errors with source spans and hints
15
16#![allow(dead_code)]
17#![allow(unused_imports)]
18#![allow(unused_mut)]
19#![allow(clippy::should_implement_trait)]
20#![allow(clippy::collapsible_if)]
21#![allow(clippy::collapsible_match)]
22#![allow(clippy::single_match)]
23#![allow(clippy::field_reassign_with_default)]
24#![allow(clippy::approx_constant)]
25#![allow(clippy::useless_format)]
26#![allow(clippy::type_complexity)]
27#![allow(clippy::ptr_arg)]
28#![allow(clippy::module_inception)]
29#![allow(clippy::unnecessary_map_on_constructor)]
30#![allow(clippy::derivable_impls)]
31#![allow(clippy::result_large_err)]
32#![allow(clippy::write_with_newline)]
33#![allow(clippy::unnecessary_map_or)]
34
35pub mod arena;
36pub mod bytecode_interp;
37pub mod closure;
38pub mod eval_error;
39pub mod gc_strategies;
40pub mod io_runtime;
41pub mod lazy_eval;
42pub mod memory_pool;
43pub mod object;
44pub mod profiler;
45pub mod rc;
46pub mod scheduler;
47pub mod string_pool;
48pub mod tco;
49pub mod wasm_runtime;
50
51// Re-exports for convenience
52pub use arena::{
53    ArenaIdx, ArenaOffset, ArenaPool, BumpArena, GenIdx, GenerationalArena, Region, RegionManager,
54    TypedArena,
55};
56pub use closure::{
57    CallConvention, CallStack, Closure, ClosureBuilder, FnPtr, FunctionEntry, FunctionTable,
58    MutualRecGroup, Pap, PapResult, StackFrame,
59};
60pub use eval_error::{
61    EvalError, EvalErrorBuilder, EvalErrorKind, EvalFrame, RuntimeError, SourceSpan,
62};
63pub use io_runtime::{
64    ConsoleOps, FileOps, IoError, IoErrorKind, IoExecutor, IoResult, IoRuntime, IoValue,
65    StringFormatter,
66};
67pub use lazy_eval::{LazyList, MemoFn, SharedThunk, Thunk, ThunkCache};
68pub use object::{
69    ArrayOps, BoxInto, FieldAccess, HeapObject, ObjectHeader, ObjectStore, ObjectTable, RtArith,
70    RtObject, StringOps, ThunkOps, TypeInfo, TypeRegistry, TypeTag, UnboxFrom,
71};
72pub use rc::{
73    ArcWeak, BorrowFlag, BorrowState, CowBox, Rc, RcElisionAnalysis, RcElisionHint, RcManager,
74    RcPolicy, RcStats, RtArc, Weak,
75};
76pub use scheduler::{
77    LoadBalanceStrategy, LoadBalancer, ParallelEval, Scheduler, SchedulerConfig, SharedState, Task,
78    TaskId, TaskPriority, TaskState, WorkStealingDeque, Worker,
79};
80pub use tco::{
81    run_tco_interpreter, trampoline, trampoline_instrumented, RecursiveStep, StepResult, TailCall,
82    TailCallCounter, TailCallDetector, TailPosition,
83};