Skip to content

Port the JS WASI polyfill to wasi-common #520

Closed
@sunfishcode

Description

@sunfishcode

Wasmtime has a JS polyfill implementation of WASI:

https://github.com/CraneStation/wasmtime/tree/polyfill/wasmtime-wasi/js-polyfill

which works by compiling wasmtime's C implementation of WASI with Emscripten, and then adding a bit of support code on top of that.

We should port the support code to work on top of wasi-common, compiled with wasm32-unknown-emscripten. In theory, all the big pieces are in place -- wasi-common provides the same functionality as Wasmtime's C implementation of WASI, Emscripten can provide the same underlying support in both cases, and the support code should roughly be the same. So the work here is in rewiring everything up in wasi.js, and porting polyfill.c to Rust, probably splitting out that EM_ASM into a standalone JS file.

I've marked this "help wanted" -- if someone's interested in doing this port, that'd be great (and I can help mentor), but it'd even help just to have more ideas for packaging, binding, or other ways we could make the polyfill better. The current support code and shell.html is super minimal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedwasi:implIssues pertaining to WASI implementation in Wasmtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions