oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.81k stars 152 forks source link

WASM support #941

Closed andychu closed 2 years ago

andychu commented 3 years ago

Why? On first glance this is probably expanding the scope of the project too much. But:

Design: Two Types of Plugins

Which Engine?

Crazy Idea

Related to #848

andychu commented 3 years ago

Some more motivation here: https://lobste.rs/s/qjeefx/wasm3_compiles_itself_using_llvm_clang#c_dpuuhg

Actually I have an idea to embed WASM in https://www.oilshell.org/ . One use case is to solve some bootstrapping problems with dev tools. For example, if you have a tool written in a native language like a parser generator, then it’s somewhat of a pain for people to either build those, or for the maintainer to distribute binaries for them (especially if they change often).

So it seems natural to write a shell script and call out to an “embedded” arch-independent binary in those cases. (Though this probably won’t happen for a long time.)

Problems with WASM

vshymanskyy commented 3 years ago

@andychu you're referring to some "odd" architectures. Please let me know what exactly you have in mind, as Wasm3 was verified to work on 10+ architectures (even Big-Endian) without issues.

andychu commented 3 years ago

Well it's more of a philosophy to have the Oil core 100% standards compliant. That way you get ALL architectures and not just 10+.

It might be worth breaking that rule for some killer feature -- maybe fast WASM is it -- but I'm not sure yet.

Are there any new docs about how to embed wasm3? That would be helpful

andychu commented 3 years ago

I guess the obvious solution is to provide a conditional compilation option, e.g. for which WASM engine to use, just like you can compile different malloc() in or whatever.

bash can be compiled with or without GNU readline, and so can Oil.

We could do that for Oil and wasm, but it would be nice to avoid fragmentation. That is if it supports wasm, then it would be nice if people can rely on it everywhere

This is a little hypothetical, since I think the wasm work is a little far in the future. Our plate is overflowing with things to do now!!

vshymanskyy commented 3 years ago

Embedding is easy, just include Wasm3 sources in your build system, and use any of the examples (I suggest to start with Arduino examples, i.e. run fibonacci function).

On Tue, Jun 15, 2021, 3:38 AM andychu @.***> wrote:

I guess the obvious solution is to provide a conditional compilation option, e.g. for which WASM engine to use, just like you can compile different malloc() in or whatever.

bash can be compiled with or without GNU readline, and so can Oil.

We could do that for Oil and wasm, but it would be nice to avoid fragmentation. That is if it supports wasm, then it would be nice if people can rely on it everywhere

This is a little hypothetical, since I think the wasm work is a little far in the future. Our plate is overflowing with things to do now!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/oilshell/oil/issues/941#issuecomment-861083183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALP3FEZXJJKS2I5REEU2ADTS2OIJANCNFSM444DI4ZQ .

andychu commented 2 years ago

Hmm this is now out of scope; we're more focused on containers #848