pywasm icon indicating copy to clipboard operation
pywasm copied to clipboard

Support WASI(WebAssembly System Interface).

Open mohanson opened this issue 6 years ago • 10 comments

docs: https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md

The WASI is still not stable. But it's not a big work, so, add this?

mohanson avatar Jun 18 '19 09:06 mohanson

First issue :smiley:

boundless-forest avatar Jun 18 '19 09:06 boundless-forest

No, it's second.

mohanson avatar Jun 18 '19 09:06 mohanson

any progress ? i'd love to have a wasi python polyfill for running micropython-wasi browser test suite.

( this is not very practical https://github.com/pmp-p/micropython/blob/wasm-nonlr/ports/wasm-no-nlr/docs/wasi-web.png )

pmp-p avatar Aug 11 '19 10:08 pmp-p

@pmp-p It is in my TODO list, but now I don't have the energy to do it. Maybe after a few months, when I am free.

mohanson avatar Aug 12 '19 01:08 mohanson

In addition to the WASI specs (https://github.com/WebAssembly/WASI/blob/master/phases/README.md), I suspect this node could be used as a reference: https://github.com/devsnek/node-wasi It's an implementation of the WASI interface in JS and uses some C bindings as well.

kanaka avatar Oct 30 '19 02:10 kanaka

Some more pointers about wasi polyfill https://github.com/bytecodealliance/wasi.dev/pull/11

and after some personnal python polyfill tests i'd say that a usefull tool for implementation would certainly be https://github.com/aguinet/dragonffi

pmp-p avatar Oct 11 '20 06:10 pmp-p

@pmp-p Are you interested in trying to complete this feature?

In fact, in another project of mine, I completed entire WASI, with about 1,000 lines of code: https://github.com/mohanson/wasc/blob/master/src/platform/posix_x86_64_wasi.h

But it can't be used directly on pywasm, because I wrote it for the wasc project and that only supports x86 and risc-v platforms.

All the work is to find a useful wasi c library, and then glue them with ffi, just like you said.

mohanson avatar Oct 11 '20 07:10 mohanson

In wasm3, we're using uvwasi as the default WASI API provider.

On Sun, 11 Oct 2020, 10:51 Mohanson, [email protected] wrote:

@pmp-p https://github.com/pmp-p Are you interested in trying to complete this feature?

In fact, in another project of mine, I completed entire WASI, with about 1,000 lines of code: https://github.com/mohanson/wasc/blob/master/src/platform/posix_x86_64_wasi.h

But it can't be used directly on pywasm, because I wrote it for the wasc project and that only supports x86 and risc-v platforms.

All the work is to find a useful wasi c library, and then glue them with ffi, just like you said.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mohanson/pywasm/issues/25#issuecomment-706665854, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALP3FBETXQ4EPQY54U32UDSKFPXFANCNFSM4HY6FUSQ .

vshymanskyy avatar Oct 11 '20 08:10 vshymanskyy

@vshymanskyy i'm specifically interested in browser polyfills ( which can't return i64 actually because wasm32 ), though i want to use wasm3 on android for cpython/wapy modules or even full interpreter sandboxing. https://github.com/libuv/libuv/blob/v1.x/SUPPORTED_PLATFORMS.md is tier 3 enough to be safe ?

@mohanson i'll have to, since i want to run cpython/wapy wasm browser testsuite somehow.

pmp-p avatar Oct 11 '20 09:10 pmp-p

For Browsers, we should reach BigInt epoch pretty soon. For Android, libuv should be pretty solid. As for WASI envirnoment for Browsers, Wasmer has provided a nice polyfill, and they also created https://webassembly.sh

vshymanskyy avatar Oct 11 '20 09:10 vshymanskyy