mohanson / pywasm

A WebAssembly interpreter written in pure Python
MIT License
443 stars 39 forks source link

Support WASI(WebAssembly System Interface). #25

Open mohanson opened 5 years ago

mohanson commented 5 years ago

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?

boundless-forest commented 5 years ago

First issue :smiley:

mohanson commented 5 years ago

No, it's second.

pmp-p commented 5 years ago

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 )

mohanson commented 5 years ago

@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.

kanaka commented 4 years ago

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.

pmp-p commented 3 years ago

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

mohanson commented 3 years ago

@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.

vshymanskyy commented 3 years ago

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

On Sun, 11 Oct 2020, 10:51 Mohanson, notifications@github.com 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 .

pmp-p commented 3 years ago

@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.

vshymanskyy commented 3 years ago

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