[Vm-dev] WebAssembly

Ben Coman btc at openinworld.com
Thu Dec 8 04:05:00 UTC 2016

I've just bumped into WebAssembly and am curious what opportunities
(or not) it might offer us.
* https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6#.60dghpaek

One approach could be to just compile our currently generated C code
to WevAssembly via LLVM. Ronie's recent effort to produce a
non-display minimal VM should help proof of concept here.
* http://webassembly.org/docs/c-and-c++/
* https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
* http://cultureofdevelopment.com/blog/build-your-first-thing-with-web-assembly/

An obvious downside would be having a VM running on a VM.  But
WebAssembly doesn't do garbage collection so at least it wouldn't
double up on that.  Possibly there would be some double-up/conflict on
JIT-ing, but there seems like there will be a facility for adding JIT
and optimisation libraries, so possibly past investment in Cog is not
lost.  Also perhaps(??) while WebAssembly is in its formative stage
right now some primitives can be added to facilitate how Cog operates.
* http://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation
* http://webassembly.org/docs/jit-library/

Another approach may be to start with SqueakJS, and work out how the
Cog JIT could be plugged into WebAssembly as a library that SqueakJS
(and others?) could use.  If its architecturally possible this might
broaden the exposure of Cog(??). What would WebAssembly require to
facilitate using Cog?

Of course all plates are full, but now seems the ideal time time to
get involved.
WebAssembly browser preview seeking community feedback concluding Q1 2017.

Chrome nightly builds available to test it

It would be amazing to run Cog in a web browser, and thus facilitate
all our favourite Smalltalk dialects.

Side thought: Craig's work to incrementally download a running image
could be useful to reducing web page startup time.

cheers -ben

More information about the Vm-dev mailing list