jolt/docs
Dmitri Sotnikov 393656d8d9
cgen: install native fns into the compile path under JOLT_CGEN (jolt-ihdp) (#146)
Wires src/jolt/cgen.janet into the backend's :def emit. With JOLT_CGEN=1 (off by
default, needs direct-linking), a plain defn of a numeric-leaf fn is compiled to
C at def time and the cfunction installed as the var root, so direct-linked
callers embed native code. The fn is not inline-stashed when cgen fires —
callers must call the C fn, not inline the bytecode body. ^:redef/^:dynamic stay
bytecode.

The leaf-first rule falls out: run calls count-point (a user var), so run isn't a
numeric leaf and stays bytecode, calling the native count-point over the cheap
forward crossing. mandelbrot 200: 224ms -> 12.4ms (~18x), result unchanged.

Adds JOLT_CGEN to ctx-shaping-env-vars (rides the disk-cache key) and :cgen? to
resolve-run-mode. Default path (cgen off) is a no-op: cgen-root returns nil and
the normal bytecode emit runs. Gate green (117 files). Test:
test/integration/cgen-pipeline-test.janet.

Co-authored-by: Yogthos <yogthos@gmail.com>
2026-06-16 17:12:48 +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 Spike: localize the mandelbrot 15x floor (jolt-5vsp) (#143) 2026-06-16 16:20:40 +00:00
foundational-runtime-lever1-native-codegen.md cgen: install native fns into the compile path under JOLT_CGEN (jolt-ihdp) (#146) 2026-06-16 17:12:48 +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