lumbda/c
russell@unturf.com b890e3641f
C tier: spawn-process-stdio + flush-port for bend cross-tier
Two new primitives in builtins.c, paralleling the Python tier shipped in
the previous commit. gpu-worker.lsp now runs on the C tier byte-identically
to the Python tier.

  (spawn-process-stdio path args) → (stdin-port . stdout-port)
    fork + pipe + execvp; child's stdin & stdout wired back to parent
    as line-buffered FILE* ports. Accepts both strings and symbols in
    the args list (matches Python tier's permissive conversion).

  (flush-port port)
    fflush() on the port's FILE*. No-op when fp is null.

End-to-end on 3090-ai with C-tier lumbda everywhere:

  shell A:  ./lumbda /tmp/launch-c.lsp
            → gpu-worker: ready cuda-shake-fanout ← ./shake256-fanout
            → gpu-worker listening on port 9091

  shell B:  ./lumbda smoke-bend.lsp        # run 3×
            === smoke-bend ===
            1. cost estimator picks local for 3 inputs: OK
            2. worker available? #t
            3. bend! (cuda-shake-fanout '("00" "01" "deadbeef") 32):
               (b8d01df855… 94da6280b2… fa094fa86e…)

Three runs identical bytes. Same hashes as Python tier. Same hashes as
hashlib.shake_256 host reference.

Cross-tier matrix (proves wire protocol is tier-agnostic):

  client tier   worker tier   status
  ─────────────────────────────────────
  C tier        C tier        PASS — 2 sequential runs, byte-identical
  Python tier   C tier        PASS — same hashes
  C tier        Python tier   implicit by symmetry (same wire bytes
                              both directions; Python-server tested
                              against Python-client in prior commit)

Per-tier status after this commit:
  Python tier ✓ end-to-end
  C tier      ✓ end-to-end + cross-tier byte-identical to Python tier
  asm tier    → still needs spawn-process-stdio via raw fork+pipe+
                execve syscalls. Scheme files unchanged.
2026-06-04 19:55:48 -04:00
..
.gitignore rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
bench.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
builtins.c C tier: spawn-process-stdio + flush-port for bend cross-tier 2026-06-04 19:55:48 -04:00
eval.c c: fix buffer overflow in load_file on non-seekable inputs 2026-06-04 12:44:43 -04:00
jit.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
jit.h rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
lumbda.h c: vm restores cur_code across CALL/RETURN, fixing JIT named-let hang 2026-06-04 01:11:18 -04:00
main.c c: enable Boehm GC by default, GC_INIT, file ops, regression test 2026-06-04 00:55:31 -04:00
Makefile c: enable Boehm GC by default, GC_INIT, file ops, regression test 2026-06-04 00:55:31 -04:00
portal.c portal-rng: add (random-seed-from-os!) across all three tiers 2026-04-20 15:50:26 -04:00
printer.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
reader.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
test.c rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
types.c cl-compat: run Zoë Trout's favorites unchanged (ticket 0004) 2026-04-24 07:02:21 -04:00
vm.c c: vm restores cur_code across CALL/RETURN, fixing JIT named-let hang 2026-06-04 01:11:18 -04:00