docs(asm): checkpoint x86_64 syscall-write example (1651)

This commit is contained in:
agra
2026-06-16 06:39:14 +03:00
parent cdd920b692
commit 59469f2b2f

View File

@@ -197,11 +197,12 @@ rule all work and execute on the host JIT. Global `asm { … }` (Phase F) works
via lib-less `extern`). `-> @place` **write-through** outputs work (Phase 2) and
**read-write (`+`)** place outputs work (Phase G — tied-input lowering, runs on
aarch64). Indirect-memory (`*`) place outputs are still rejected loudly as
not-yet-implemented — the only remaining substantive feature. Smaller
follow-ups: the comptime-call guard for global asm (`#run` into a module-asm
symbol should fail loud via dlsym-miss — pin a test), a JIT-vs-global-asm note
(`sx run` silently mishandles module-asm symbols; AOT is correct), and the x86_64
syscall ir-only example. `readme.md` now has an "Inline Assembly" section.
not-yet-implemented — the only remaining substantive feature. The x86_64
syscall-write ir-only example is DONE (1651). Smaller follow-ups: the
comptime-call guard for global asm (`#run` into a module-asm symbol should fail
loud via dlsym-miss — pin a test) and a JIT-vs-global-asm note (`sx run` silently
mishandles module-asm symbols; AOT is correct). `readme.md` now has an "Inline
Assembly" section.
Known orthogonal bug: **issue 0137**`sx run` on a program with no `main`
segfaults (`src/target.zig:256-273`, unguarded JIT entry lookup). Pre-existing,
@@ -224,10 +225,14 @@ needed. Regression: `examples/1177-diagnostics-addr-of-const-rejected.sx`.
Remaining work, all optional / additive:
- **Indirect-memory (`"=*m"`) outputs**: pass the place address as an arg, asm
writes through it (no return slot). Currently rejected.
- **Output-to-`const` rejection** for `-> @place` (the place must be mutable).
writes through it (no return slot). Currently rejected. The last substantive
feature; needs `elementtype` type-attribute plumbing on the indirect arg
(precedent: `sret` in `emit_llvm.zig`/`ops.zig`).
- **Polish**: comptime-call guard test for global asm; make `sx run` error (not
silently mishandle) a module-asm symbol; x86_64 syscall-write ir-only example.
silently mishandle) a module-asm symbol.
Done since last: output-to-`const` rejection (issue 0138), x86_64 syscall-write
ir-only example (1651).
Orthogonal: **issue 0137** (no-`main` segfault).
@@ -294,6 +299,12 @@ Orthogonal: **issue 0137** (no-`main` segfault).
keep storage. asm `-> @const` gets the clean diagnostic for free (same path).
Regression `examples/1177-diagnostics-addr-of-const-rejected.sx`. Issue 0138
RESOLVED. `zig build test` green (659 corpus, 446 unit).
- (x86 syscall) x86_64 Linux `write(2)` via raw `syscall` — locks the constraint
string `={rax},{rax},{rdi},{rsi},{rdx},~{rcx},~{r11},~{memory}` (register-pinned
inputs + pinned value output + pointer input + clobbers). ir-only on aarch64
(`.ir` asserted), runs on x86_64-linux (hand-authored `"ok\n"` stdout).
`examples/1651-platform-asm-x86-syscall-write.sx`. Pure additive lock, no
compiler change. `zig build test` green (660 corpus, 446 unit).
## Known issues
- **0138** — RESOLVED. `@const` (address-of a `::` comptime constant) yielded a