Reuse owned erased callables through aggregate transitions - #10530
Reuse owned erased callables through aggregate transitions#10530lukewilliamboswell wants to merge 16 commits into
Conversation
…-fixes # Conflicts: # src/check/checked_artifact.zig
|
Datastar SSE follow-up evidence for 5a5f4c0: A socket-level basic-webserver comparison isolated payload repetition, HTML assembly, Datastar framing, and transport on the same application commit. Replacing one-copy-per-repetition in Str.repeat with bulk fill/doubling produced:
The repeat-only control accounts for the change while the assembly and transport controls remain stable. Per-event allocation and reallocation slopes are identical before and after, so this is a fill-efficiency improvement rather than an allocation-count change. Validation: Roc mini-CI 74/74 passed, including full eval, SIMD differential, CLI, Wasm static library, dylib, and archive phases. Raw paired data and analysis are on basic-webserver PR #208: roc-lang/basic-webserver#208 |
…k-arc # Conflicts: # src/postcheck/lambda_solved/solve.zig
This draft reuses an owned erased-callable allocation when an erased call returns exactly one statically selected erased callable, including inside aggregate and tag results. The uniform host-visible erased-callable ABI takes a nullable fifth reuse pointer: null transfers nothing; non-null transfers exactly one owned reference, which the callee must either return in the selected slot or decref exactly once. Capture bytes needed during in-place repack are snapshotted before overwrite, while shared, ambiguous, and incompatible cases allocate and release the transferred ownership.
Lowering carries return destination and ownership provenance as explicit producer-authored data instead of scanning completed LIR. LLVM and production Wasm use the shared nullable-safe repack builtin; the interpreter and legacy Wasm evaluator implement the same contract. Generated C, Rust, and Zig ABI types document the host responsibility, and end-to-end host tests cover both declining reuse with null and consuming non-null reuse.
The PR also makes generated Rust tag payload ownership explicit through borrowed access and unsafe consuming moves, and includes the hosted Try row-adapter and ARC-certifier fixes required by these paths.