Comment #0 by petar.p.kirov — 2017-10-09T09:35:03Z
The first step to WebAssembly support is adding a predefined version, so libraries can adapt (for example the D bindings for SDL2). It is yet to be determined if more parts of the language can be used in addition to the betterC subset, so this may or may not be used in druntime for implementing full run-time support.
Comment #1 by petar.p.kirov — 2017-10-09T14:09:13Z
Comment #3 by github-bugzilla — 2017-10-12T19:46:19Z
Commit pushed to master at https://github.com/dlang/dmdhttps://github.com/dlang/dmd/commit/8cd923389443cb018feadb1b0b91598cf6b9cc53
Fix issue 17887 - Add AsmJS, Emscripten and WebAssembly version identifiers
WebAssembly (http://webassembly.org/) is a is a low-level binary format
for in-browser client-side scripting (though support for non-browser
execution environments is also planned) and also a JavaScript API. See
https://github.com/WebAssembly/design/blob/master/Portability.md
for more information on the characteristics of this virtual ISA.
All major browser vendors have reached consensus on the WebAssembly API
and binary format, so growth opportunity for D in this area is huge.
The current feature set and toolchain is based on asm.js
(http://asmjs.org/spec/latest/) and Emscripten
(http://kripken.github.io/emscripten-site/).
Emscripten is a toolchain for converting LLVM IR to JavaScript/asm.js.
Emscripten uses the musl (http://www.musl-libc.org/) libc library,
which potentially requires improving the `version (CRuntime_Musl)`
support in druntime and phobos.
In a couple of years asm.js may be phased-out in favour of WebAssembly,
but for now it is necessary as WebAssembly is not mature enough.