Skip to main content

luna_core/runtime/
mod.rs

1//! Runtime core: values, GC heap, strings, tables, function objects.
2
3pub mod coroutine;
4pub mod frame_marker;
5/// v2.13 WUC `gc-verify` — thread-local log of every freed GcHeader
6/// pointer, written by `Heap::free_obj` and consulted by read-time
7/// probes (e.g. `Table::find_node`) to catch a dangling reference at
8/// the exact dereference site. Exact under quarantining allocators
9/// (ASAN); plain allocators may reuse a pointer and mask a hit.
10#[cfg(feature = "gc-verify")]
11pub(crate) mod gc_verify_probe {
12    use std::cell::RefCell;
13    use std::collections::HashSet;
14    thread_local! {
15        pub(crate) static FREED: RefCell<HashSet<usize>> = RefCell::new(HashSet::new());
16    }
17    pub(crate) fn is_freed(p: usize) -> bool {
18        FREED.with(|f| f.borrow().contains(&p))
19    }
20}
21pub mod function;
22pub mod heap;
23pub mod string;
24pub mod table;
25pub mod userdata;
26pub mod value;
27
28pub use coroutine::{Coro, CoroStatus};
29pub use function::{
30    AfterClose, CallFrame, CloseCont, ContKind, Frame, LocVar, LuaClosure, MetaAction, MetaCont,
31    NativeClosure, NativeCont, Proto, UpvalDesc, UpvalState, Upvalue,
32};
33pub use heap::ObjTag;
34pub use heap::{Gc, Heap};
35pub use string::LuaStr;
36pub use table::{Table, TableError};
37pub use userdata::{FileHandle, Userdata, UserdataPayload};
38pub use value::Value;