jolt/test
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
..
bench Parallelize the test gate; cache cold-init tests, drop the benchmark from it (#139) 2026-06-16 14:23:02 +00:00
clojure-stdlib/clojure Compiler research (#10) 2026-06-09 07:30:25 +08:00
integration cgen: install native fns into the compile path under JOLT_CGEN (jolt-ihdp) (#146) 2026-06-16 17:12:48 +00:00
spec Library ports: get hiccup running, verify malli (reader + interop fixes) (#127) 2026-06-15 19:36:13 +00:00
support core: AOT context image — init-cached recovers the bootstrap cost across processes 2026-06-10 13:57:37 -04:00
unit Persistent hash map: HAMT instead of O(n) copy-on-write (jolt-684u) (#136) 2026-06-16 05:01:22 +00:00