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
|
||
|---|---|---|
| .. | ||
| lumbda | ||
| lumbda-full | ||
| lumbda-full.o | ||
| lumbda-gc | ||
| lumbda-gc.o | ||
| lumbda.o | ||
| lumbda.s | ||
| Makefile | ||
| test.sh | ||