luna-runtime-helpers 2.10.0

Static-link runtime entry for AOT-produced binaries. Exposes a single C-ABI symbol `luna_aot_run(bytecode, len) -> i32` that constructs a luna `Vm`, `undump`s the embedded bytecode, calls the root chunk, and returns a process exit code. Built as a `staticlib` so `luna-aot`'s `cc` link step can statically pull it (plus rust stdlib) into the produced native binary. Also built as `rlib` so `luna-aot`'s integration tests can drive it via the Rust runtime.
Documentation

luna-runtime-helpers — the static-link runtime entry for the binaries that luna-aot produces.

Role in the v1.3 Phase AOT pipeline

luna-aot compile foo.lua --out foo walks:

  1. Parse + compile foo.lua to a luna bytecode dump (Stages 1-2).
  2. Emit a .luna.bytecode data section in a fresh .o (Stage 5).
  3. Build this crate as a staticliblibluna_runtime_helpers.a bundles the rust stdlib + luna-core + this thin C-ABI entry.
  4. Emit a tiny C main that calls into [luna_aot_run] passing the bracket-symbol bounds of the bytecode section (Stage 6).
  5. cc links bytecode.o + main.o + libluna_runtime_helpers.a
    • -lpthread -ldl -lm into the final executable.

The produced binary at run time:

  • the C main calls [luna_aot_run(bytecode_ptr, len)][luna_aot_run]
  • [luna_aot_run] constructs a Vm, allows bytecode loading, calls Vm::load(slice, b"=embedded") (which routes through luna_core::vm::dump::undump because the slice starts with \x1bLua), then Vm::call_value on the resulting root closure
  • normal print(...) from the script lands on stdout via std::io::stdout inside luna-core's builtins (no surprises)
  • exit code 0 on success, 1 on load / runtime error

Why a separate crate (not folded into luna-aot)

luna-aot is the build-time tool — it pulls object + clap and eventually all of cranelift. The deploy-side binary must not pull cranelift; it only needs the luna interp. Splitting this entry into its own crate keeps the deploy-side .a tight (rust stdlib + luna-core only) and lets luna-aot invoke cargo build -p luna-runtime-helpers --release without dragging its own dep tree into the link.

luna-core 0-third-party-dep contract

Unchanged. cargo tree -p luna-core --prefix none | grep -cE " v[0-9]" continues to report 1. This crate sits above luna-core in the dep graph; nothing here flows back into luna-core.