Skip to content

feat: add support for WASIp1 programs (Flatware) - #78

Merged
Akshay-Srivatsan merged 11 commits into
mainfrom
flatware
Oct 8, 2026
Merged

Akshay-Srivatsan merged 11 commits into
mainfrom
flatware

Conversation

@Akshay-Srivatsan

Copy link
Copy Markdown
Contributor

This is a bit of an omnibus PR since I kept running into random things I meant to clean up anyway, but roughly this PR:

  1. Documents Arca, Fix, and Flatware's intended designs.
  2. Locks the Handle code to a specific bit representation rather than auto-deriving it via BitPack. The representation is almost what we designed for the old Fix, but it's extended for the three-way canonical/machine/local distinction and for the Eq bit. The Handles are now uniformly represented as either [u8; 32] (kernel) or u8x32 (userspace); we no longer unpack them into a Rust enum.
  3. Implements Flatware, roughly based on Haibib's and Saibi's "Arcware" design from the summer. I made a few tweaks to make some things simpler (mostly merging the filesystem and descriptor tables since WASIp1 doesn't really distinguish them anyway).
  4. Adds C/C++/Rust "SDKs" for writing Fix functions. The C SDK is basically just the raw Fix Wasm API, but the C++ and Rust SDKs expose a more-or-less "normal" Fix ontology. Programs interact with Handles to Objects, Ref, Thunks, and Encodes; these operations are lazy and build up an expression AST, then call out to a C interpreter when they actually need data to give to the client program.
  5. Implements the missing eq bit based on rules which I think are sound. We should probably prove this... I couldn't find a concrete equality definition in the coupon proof that matched what makes sense to me operationally.
  6. I think I probably added more functionality to the Fix Shell in the process of doing the rest of this?

Still TBD:

  1. Continuation support in Fix.
  2. Connecting the coupon collector to the actual Fix API and scheduler.
  3. In-process local handles backed by virtual addresses.
  4. Any sort of on-disk persistence of Fix values.

With my apologies to anyone who tries to review this 14000 line diff... this PR adds almost a third to the codebase. Although at least it's only like 7000 lines of actual code? And the final total is now about the same as the original Fix codebase?

Collect the human-written interface and handle specifications and repository guidelines.
Keep allocator growth within the linker-defined user heap rather than assuming an address-space location.
Return the replaced entry from nested mappings, expose implemented Table reads, and retain shared Table backing. Cover these behaviors in kernel mapping tests.
@Akshay-Srivatsan

Copy link
Copy Markdown
Contributor Author

For what it's worth each commit on this branch is meant to be an independent change, GitHub just won't let me make it a PR stack unless I create a new branch for each one.

@Akshay-Srivatsan
Akshay-Srivatsan force-pushed the flatware branch 3 times, most recently from bfcc15c to b75b214 Compare October 6, 2026 01:42
Use Handle for existing Fix values and Value adaptors for pending values. Read from borrowed lookup paths or recipe memory and interpret returned values through the C bridge with one scratch Memory and Table.

Provide eager child callbacks, checked TryFrom conversions, tuple Tree construction and unpacking, allocation-free iteration, and vector-returning reads. Delegate equality to Fix. Recursive clients can return Fix application thunks or use Rc<dyn Value> when allocating.
Provide thin C Wasm imports and explicit Memory and Table operations. Cover the native bindings with an integration test and gate Rust vector-returning reads behind alloc.

Add clang-format and clang-tidy checks for SDK C sources, include them in repository checks, and provide a general autoformatter for Rust and SDK C.
Add blob, addition, and directory-path programs in each language. Keep Rust path lookup allocator-free using Fix application thunks. Exercise path lookup with references, missing entries, and empty directories, and validate standalone launchers using the C programs.
@Akshay-Srivatsan
Akshay-Srivatsan force-pushed the flatware branch 2 times, most recently from e895d5d to 107bb57 Compare October 8, 2026 07:17
Run all jobs on Ubuntu 26.04 and separate their Bazel disk caches from Ubuntu 24.04. Install the distro Binaryen package alongside native build tools so Flatware has wasm-merge. Document the local build prerequisite.
Link standard WASIp1 guests with a separate-memory Fix adapter using wasm-merge. Support buffered standard streams, files and directory preopens, deterministic clocks, MT19937-64 random bytes, and proc_exit.

Use canonical descriptor/stat trees and the upstream allocator and PRNG dependencies. Cover filesystem capabilities and compile Rust WASIp1 programs for integration tests.
Run WASIp1 modules against directory snapshots with buffered stdin, host stdout/stderr, guest exit status, and returned files in a fresh temporary directory. Add runnable ls, wc, cat, and head programs and end-to-end runner tests.
Expose freestanding C compilations as individual CppCompile actions and extract their flags with pinned Hedron. Adapt its Python/C++ rules and header discovery for Bazel 9.

Add bazel run //:lsp to regenerate both compile_commands.json and rust-project.json. Preserve Wasm link optimization and ABI flags when separating compile and link actions.
@Akshay-Srivatsan
Akshay-Srivatsan merged commit 4866c13 into main Oct 8, 2026
8 checks passed
@Akshay-Srivatsan
Akshay-Srivatsan deleted the flatware branch October 8, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant