On Sunday, 30 October 2016 at 05:30:04 UTC, Dicebot wrote:
On Saturday, 29 October 2016 at 21:46:37 UTC, Laeeth Isharc wrote:
Any thoughts on how much work is involved to port the runtime?
And what other changes might be involved? The chap that used the C backend for LLVM wrote a little mini runtime but I guess didn't have to worry about the version blocks in the compiler front end as much. (don't recall what architecture he pretended to be compiling to).

Glibc has obviously already been ported to run in browser by emscripten.

I have actually meant something quite different - implementing new backend for DMD which emits wasm directly (possibly by embedding binaryen). That is more work than simply using LLVM stack as-is but would result in unique marketing advantage - existing pipeline of C -> Emscripten -> asm.js -> asm2wasm is rather annoying. And native wasm backend for LLVM is in development for quite a while now with no clear ETA.

At the same time intended wasm spec (https://github.com/WebAssembly/design) is much more simple than machine code for something like x86_64. If Walter gets interested, that may be a feasible path :)

Existing pipeline is string together with gaffer tape and string, so it's hardly there yet - and add up that, last I looked, when you turned on O2 with emscripten it didn't always go well.

But what I meant was LLVM will have a wasm backend. So on basis of my limited understanding, it would be some work to make LDC produce wasm code, and then runtime and phobos would need work. Adam Ruppe of course had something like this working with plain javascript and dmd about four years back, including basic D wrapping of DOM etc and extern(js). But compiler has diverged a bit from that version used, and I guess at time there wasn't the interest or manpower to turn that experiment /prototype into something one could depend on. But maybe someone would pick it up now more people start to be involved, given that Walter has higher priority things to do.

And wouldn't the changes to runtime and phobos be quite similar for both dmd and ldc? I don't see how the work flow would be any different as a language user whether you used an LDC with wasm back end, or dmd with similar.

Joakim - native on mobile is so much better (setting aside having to deal with Apple or Google) but I guess the browser isn't going away on the desktop for a while yet.


Reply via email to