diff options
Diffstat (limited to 'docs/history/51-llvm-inline-stdlib/notes.md')
| -rw-r--r-- | docs/history/51-llvm-inline-stdlib/notes.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/history/51-llvm-inline-stdlib/notes.md b/docs/history/51-llvm-inline-stdlib/notes.md new file mode 100644 index 0000000..c061f7b --- /dev/null +++ b/docs/history/51-llvm-inline-stdlib/notes.md @@ -0,0 +1,19 @@ +# 51 llvm inline, stdlib, host syscalls + +what was asked: finish the open tasks in any order (task 19 llvm inlining of o3 calls, task 38 stdlib expansion with a host syscall notation), then fuzz every part of the toolchain. + +what landed: +- llvm inlining of o3-to-o3 calls (task 19). a callee is inlined into the caller's native code behind a check that its region still holds, so a self-modifying callee falls back to the native entry. checked against the interpreter on every example and test with ZYHOT=1 (117 files, 0 diffs). a call-heavy helper benchmark took 2.46 s with ZYNOINLINE=1 and 2.29 s with inlining (about 7 percent). +- stdlib (task 38): Text gains len, eq, copy, find, lower, upper and trim; a new Num group gains abs, min, max, clamp, gcd, pow, isqrt and sign. tests/stdmore.zc. +- host syscall notation (task 38): SYS_RAW (op 40) runs any linux syscall on the host. the block holds the number and six arguments, and the result is the kernel's or -errno. Host.raw(nr, a, b, c, d, e, f) in lib/std.zc builds the block. it is host-only and bypasses the vm's checks, so it is a deliberate escape hatch. tests/rawsys.zc, and tests/rawpid.zc on x86-64 only (syscall numbers differ on arm64). +- the full make test passed: 571 passed, 0 failed. + +also landed: cross-block copy propagation in the global pass (task 20). a copy fact (C_COPY) says a variable holds what another holds at block entry, a read of the copy becomes a read of the source, and a block that writes the source drops the fact. tests/o3copy.zc; the full suite and an llvm ZYHOT=1 comparison over 120 files agree. + +automatic tiering was dropped by decision (tasks 25 and 35). it needed a calling-convention change for unannotated functions; design/tiering.md has the analysis. task 17 is closed with the perf work that landed. + +fuzzing (scratchpad campaign, every target): +- sanitizer builds rebuilt from the current tree (zc0, zy, zym, zyl, lsp, mkgenome, genmap). +- found: under ASan only, an unbounded o3 recursion grows host memory until the OOM killer stops it. the plain, -O0, -O1, -O2 and UBSan builds stop with "frame stack overflow". the ASan build's o3 path does not hit the frame check. the reproducer is `o3 int f(int n) { return f(n + 1) + 1; }`. +- found: a zy vs zym difference on an unchecked program that exhausts the heap. the microcore has a fixed map and reports out of heap memory where the hosted heap grows. the diff harness now skips runs that hit a resource limit. +- the harness now has an RSS watchdog (2.5 GB) so a runaway child is killed instead of taking the host down. |
