lumbda/c
russell@unturf.com 0cf66cc3dd
jit: save/restore loop_slots across nested named-let
When inner (let loop ((i ...))) shadows an outer (let loop ((a ...) (b ...))),
the inner named-let block was overwriting j->loop_slots[] without saving
the outer's slot positions. After the inner block restored loop_sym /
loop_nparams / loop_params, the outer's recursive call (loop new-a new-b)
would write the new args into the inner's stale slot positions instead
of the outer's slots, causing the outer body to see stale binding values
or trigger 'set! undefined' on tail-call args.

loop_slots is a member ARRAY (not pointer) — memcpy'd at line 876 when
setting up loop context — so the existing pointer save/restore for
loop_params didn't cover it.

Verified:
- jit_named_let_factorial still PASS (3628800)
- new nested-shadowing test: outer 3-param + 4 inner 1-param now PASS
- exact replica of squaring.lsp round84-fold structure now PASS

Bug surfaced when investigating test-round84-keep-quotient-product
failure in www.foxhop.net/ecdsa tests. Test still has a deeper substrate
bug beyond this JIT fix (width 0 ancilla in non-fast mode), but this
fix is independently correct + closes the loop_slots scope leak.
2026-06-14 18:33:15 -04:00
..
.gitignore rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
bench.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
bignum.c c-tier bignum — arbitrary-precision integers unblock secp256k1 widths 2026-06-06 20:23:37 -04:00
builtins.c fork-self + waitpid-nonblock + exit-immediate + sleep primitives across c-tier + python-tier 2026-06-11 09:24:51 -04:00
eval.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
gc.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
jit.c jit: save/restore loop_slots across nested named-let 2026-06-14 18:33:15 -04:00
jit.h rename: uncommonlisp -> lumbda throughout the repo 2026-04-19 10:20:11 -04:00
lumbda.h python + c bytecode VM: OP_SELF_TAIL_CALL frame-unwind fix 2026-06-14 14:58:30 -04:00
main.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
Makefile c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
portal.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
printer.c c-tier bignum — arbitrary-precision integers unblock secp256k1 widths 2026-06-06 20:23:37 -04:00
reader.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
test.c c: precise GC tracing for NaN-boxed Values 2026-06-07 17:18:45 -04:00
types.c c tier: rationals on int/int division — matches python lumbda 2026-06-14 14:23:54 -04:00
vm.c python + c bytecode VM: OP_SELF_TAIL_CALL frame-unwind fix 2026-06-14 14:58:30 -04:00