lumbda/c
russell@unturf.com 3463fadd3f C --fast named-let bug: minimal repro + workaround, all 4 tiers pass now
Hunted the C --fast compiler bug that was hanging on the EML proof.
Narrowed to a specific pattern:

  (let loop ((t start))
    (let ((next (fn t)))
      (if next (loop next) t)))

A named-let whose body is (let ((x (...))) (if x (recurse x) base)).
The recursive call inside the inner let+if branch never reaches the
loop closure — hangs or segfaults.

Reproducible with a 4-line test case; filed as
c/TODO-named-let-bytecode.md with minimal repro, suspected cause
(env-chain mismatch between PUSH_ENV and TAIL_CALL), and a known-
good workaround.

Workaround landed in proof/eml_proof_in_lumbda.lsp's `normalize`:
replaced the named-let with an internal recursive `define`, which
compiles correctly under --fast. Same logic, different surface
syntax. All four Lumbda tiers now verify the proof.

Benchmark refreshed (make bench-proof):

                              cold     cached
  Lumbda asm                   46 ms    7 ms
  Lumbda C --fast              65 ms    9 ms
  Lumbda C (tree-walker)       87 ms   12 ms
  Lumbda Python --fast        651 ms  232 ms
  Lean 4                      722 ms    5 ms

All four tiers now green. Asm still fastest (46 ms cold vs Lean's
722 ms — ~16× faster). Cached Lumbda asm 7 ms vs Lean 5 ms (within
1.5×). The C --fast tier went from "hangs" to 65 ms cold — competitive
with asm once the compiler bug is dodged.

Whitepaper §8.6 table updated; prior "(hangs)" row is gone;
footnote on the named-let workaround links the TODO file.
2026-04-17 20:56:00 -04:00
..
.gitignore Add C implementation: 7,429 lines, 58 tests, identical output 2026-04-14 14:55:17 -04:00
bench.c JIT: add named-let loops, let/let*, and/or, car/cdr/cons, 18 new tests 2026-04-14 20:50:24 -04:00
builtins.c S-expressions over sockets — RPC + remote REPL in portable Scheme 2026-04-17 09:00:04 -04:00
eval.c portal over HTTP: 9/9 cross-runtime, plus eval-to-global-env fix 2026-04-17 13:41:48 -04:00
jit.c JIT: add named-let loops, let/let*, and/or, car/cdr/cons, 18 new tests 2026-04-14 20:50:24 -04:00
jit.h Add GPU architecture notes and JIT header 2026-04-14 19:43:16 -04:00
main.c C: --fast documented for deep recursion; whitepaper numbers corrected 2026-04-17 18:54:06 -04:00
Makefile C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
portal.c C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
printer.c Add C implementation: 7,429 lines, 58 tests, identical output 2026-04-14 14:55:17 -04:00
reader.c Add C implementation: 7,429 lines, 58 tests, identical output 2026-04-14 14:55:17 -04:00
test.c C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
TODO-named-let-bytecode.md C --fast named-let bug: minimal repro + workaround, all 4 tiers pass now 2026-04-17 20:56:00 -04:00
types.c C: add deep_copy_env, VM frame stack for continuations 2026-04-15 19:57:17 -04:00
uncommonlisp.h C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
vm.c C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00