lumbda/asm
russell@unturf.com 6262a24d47
asm tier: read-line for subprocess pipes
Closes the last asm-tier gap for hosting bend workers:

  (read-line port) → string or #f
    Reads bytes one at a time from the port's fd until '\n' or EOF.
    Strips the trailing newline. Returns #f when no bytes were
    available (peer closed / pipe drained).

Verified end-to-end on 3090-ai:

  λ> (define p (spawn-process-stdio "./shake256-fanout" (quote (--daemon))))
  λ> (display (read-line (cdr p))) (newline)
  ready
  λ> (display "quit\n" (car p))
  λ> (flush-port (car p))
  λ> (display (read-line (cdr p))) (newline)
  bye

asm tier can now spawn, write, flush, read line — the full
subprocess capability gpu-worker.lsp's daemon pool needs.

Implementation:
  - Stack scratch buffer: 4096 bytes via %rbp (heap-safe; %r15 is
    lumbda's heap pointer, do not touch)
  - One-byte-at-a-time SYS_READ via fd from decode_port
  - Max line: 4094 bytes (fits the daemon protocol — "ready",
    "done /path", "bye" all under 100)
  - heap_alloc(8 + len) + length header + byte copy + TAG_STRING
    matches the Python/C tier string format byte-for-byte
  - GC_NAIVE path stamps HT_STRING header for the GC pass

BI_READLINE = 123; GC_* renumbered to 124..128; BI_COUNT = 129
(GC_NAIVE) / 124. bn_readline added to symbol table + name array.

Remaining asm-tier gaps for full gpu-worker.lsp hosting:
  - *argv* binding (used to parse --port)
  - define-syntax + syntax-rules (used by bend.lsp macros — handled
    by splitting bend-macros.lsp out in a prior commit)
  - error builtin (also handled by portable bend-error wrapper)

Per-tier matrix:
  Python tier ✓ macro + function client; full worker host
  C tier      ✓ macro + function client; full worker host
  asm tier    ✓ function client; subprocess primitives complete;
               gpu-worker.lsp needs *argv* + a few other helpers
               before pure-asm hosting is fully working
2026-06-04 20:58:10 -04:00
..
lumbda asm: argv script-mode + always-on eq? prelude (defects #28, #30) 2026-06-04 12:49:13 -04:00
lumbda-full asm: argv script-mode + always-on eq? prelude (defects #28, #30) 2026-06-04 12:49:13 -04:00
lumbda-full.o asm: argv script-mode + always-on eq? prelude (defects #28, #30) 2026-06-04 12:49:13 -04:00
lumbda-gc asm: argv script-mode + always-on eq? prelude (defects #28, #30) 2026-06-04 12:49:13 -04:00
lumbda-gc.o asm: argv script-mode + always-on eq? prelude (defects #28, #30) 2026-06-04 12:49:13 -04:00
lumbda.o asm: argv script-mode + always-on eq? prelude (defects #28, #30) 2026-06-04 12:49:13 -04:00
lumbda.s asm tier: read-line for subprocess pipes 2026-06-04 20:58:10 -04:00
Makefile asm/lumbda-full: quasiquote + define-macro + prelude (ticket 0005) 2026-04-24 12:02:12 -04:00
test.sh asm: rest args, cadr, sort, let* — Scheme port of Zoë's favorites runs 2026-04-24 09:01:32 -04:00