inko icon indicating copy to clipboard operation
inko copied to clipboard

Support compiling to WASM

Open yorickpeterse opened this issue 8 years ago • 2 comments

At some point the Aeon compiler should support a WebAssembly backend so you can use Aeon (at least to a certain extend) to build browser applications. Because it will probably take a few years for WebAssembly to become usable this is something I don't expect to be available until 2020-ish.

yorickpeterse avatar Sep 22 '16 23:09 yorickpeterse

IIRC there's still no 64-bits WASM, which the VM requires. I doubt we'll see this any time soon, and WASM isn't really of interest to me at this point. As such, I'll close this issue.

yorickpeterse avatar Aug 16 '20 01:08 yorickpeterse

It's been 7 years and I believe WASM is a bit more viable these days, especially since LLVM should be able to do the heavy lifting of turning Inko code into WASM.

There are however a few challenges:

  1. The runtime also needs to be compiled to WASM
  2. WASM IIRC still doesn't do 64 bits integers. Unless these are automatically emulated using 32 bits integers by Rust/LLVM, we may need to change the runtime somehow to accommodate that
  3. The runtime uses threads and those aren't a thing on WASM I believe. I'm not sure what the idiomatic approach is, but it may involve a #[cfg(...)] in the right places to disable threads on WASM
  4. The runtime probably uses other bits and pieces that don't work on WASM, such as file system IO, non-blocking sockets (I think?) and more

Or to put it differently, we need to first start with figuring out what exactly would need to be changed in the runtime such that we can compile it to WASM.

The end goal is to be able to use this to build a playground (https://github.com/inko-lang/inko/issues/199), removing the need for running a server somewhere that runs Inko programs in a sandbox.

I've added the "accepting contributions" label because I think the research side of things is very much doable by contributors. Depending on the scope of changes I may prefer to make the actual changes myself though, so please don't open a PR that changes 5000 lines before discussing it :smiley:

yorickpeterse avatar Nov 16 '23 23:11 yorickpeterse