jolt/docs
Dmitri Sotnikov 6cace3db90
cgen: single-binary native build via jolt cgen-build (jolt-a7ds) (#150)
Fuse an app's native-compiled numeric-leaf fns plus its source into one
static executable: no sidecar .so, no toolchain on the target. The AOT path
(#148) already produced a prebuilt module + manifest; this links them into
the jpm-built exe so the app ships as a single file.

`jolt cgen-build -m NS -o OUT` stages a build dir (src/jolt-core symlinks
into the jolt tree, a generated cg.c of the hot fns, an uberscript bundle of
the app, and an entry that bakes the runtime, installs the native fns as var
roots, and runs -main), then runs `jpm build` there — declare-native builds
cg.a and declare-executable static-links it (jpm's create-executable marshals
the module cfns and calls its static entry at startup).

Build needs cc + jpm; the result needs neither. Mechanics that bit, codified
in cgen_build.janet: stdlib_embed slurps .clj cwd-relative so the build runs
in a repo-mirroring dir; jpm hardcodes ./project.janet and sets syspath=modpath;
the executable's dofile imports cg and static-links cg.a, neither ordered nor
release-built by default, so deps are wired explicitly; cleanup must lstat (the
tree symlinks must not be followed); the inner build runs --workers=1 so it
doesn't starve siblings in the parallel gate.

test/integration/cgen-build-test.janet builds the mandelbrot fixture, runs it
from a clean dir with no src/ and no cg.so, and checks the total at native
speed. Closes jolt-a7ds.

Co-authored-by: Yogthos <yogthos@gmail.com>
2026-06-16 20:34:10 +00:00
..
rfc Fix -m arg drop under whole-program cache (jolt-4mui) + RFC 0003 sync (#138) 2026-06-16 13:34:08 +00:00
spec Library ports: get hiccup running, verify malli (reader + interop fixes) (#127) 2026-06-15 19:36:13 +00:00
architecture-refactor-plan.md Architecture refactor: plan + phase 0 (dead code + bugs) (#106) 2026-06-15 03:01:55 +00:00
building-and-deps.md Fold jolt-deps into the jolt binary (#133) 2026-06-16 10:30:28 +08:00
foundational-runtime-handoff.md docs: update foundational-runtime handoff to current status (#149) 2026-06-16 20:34:06 +00:00
foundational-runtime-lever1-native-codegen.md cgen: single-binary native build via jolt cgen-build (jolt-a7ds) (#150) 2026-06-16 20:34:10 +00:00
foundational-runtime-spike-results.md Spike: localize the mandelbrot 15x floor (jolt-5vsp) (#143) 2026-06-16 16:20:40 +00:00
grammar.ebnf Protocol/interop fixes to run metosin/malli (jolt-ltwk) (#105) 2026-06-15 03:20:33 +00:00
libraries.md docs: note malli, markdown-clj, hiccup in libraries.md (#128) 2026-06-15 20:21:25 +00:00
seed-overlay-registry.md Refactor phase 5d/5e: seed↔overlay registry + rep↔API boundary docs (jolt-bvek) 2026-06-15 04:22:05 -04:00
self-hosting-architecture.md docs: consolidate doc/ into docs/ 2026-06-10 12:10:28 -04:00
self-hosting-compiler.md Direct-link + whole-program by default for program runs; open for the REPL 2026-06-14 15:44:01 -04:00
tools-deps.md Fold jolt-deps into the jolt binary (#133) 2026-06-16 10:30:28 +08:00