Status of WebAssembly (for Julia), e.g. threads and GC

I see threads are going up to Phase 3 - Implementation Phase (where GC already is): proposals/README.md at d2f6ce711249d37fc21a8933de1f7903cb521302 · WebAssembly/proposals · GitHub

It’s not done but both would help Julia. Julia can already run in WebAssemly with its own GC. Do you see anything there important for Julia, or good to have such as GC, not needing to provide your own. I guess couldn’t provide threads even if it wanted (except for green threading).

https://webassembly.org/roadmap/

I actually that some of the “In-progress proposals” are actually already done (just not part of the standard yet), e.g. “Threads and atomics”, I suppose the same thing (and Exception handling) in the major web browsers: Roadmap - WebAssembly

Anything important going on for Julia with WebAssembly, as is, i.e. not needed any changes?

2 Likes
4 Likes

What do you mean by “not needed any changes”? You mean to ask “Anything important going on for Julia with WebAssembly, as in, is there anything that can be used nowadays?”

If that’s the question, then

and

Are probably still the most important repositories.

There is also

but that seems to be there to modify the internal representation (IR) and not to generate Julia.

Having said that, and I’m happy to be proven wrong here, without static compilation I don’t see how Julia is going to support WebAssembly. Since types can always be Any, you don’t know for sure what dispatches you have to prepare meaning that you have to bring the compiler along which just isn’t very pleasant if you’re developing things for browsers. It would mean that browsers have to download the compiler every time. Alternatively you could enforce that all types are known so that it is fully static, but that makes programming in Julia and using Julia Base a lot more difficult.

2 Likes

No, I know you can already (but was surprised to see what was done used the Julia interpreter, not compiling, so that would be one more reason slower on the web).

I meant for what is already possible, to run Julia with WebAssembly, can it be improved? I’m sure it can. But are we blocked on something, would we rather want WebAssembly extended, and are waiting on e.g. GC to be added?

2 Likes

Since I wrote this WebGC has been enabled by default in August (on Github) in Safari/Webkit software, but unclear if it will be released in Safari 19 or sooner. It was the last major holdout, so now it’s good to target WebAssembly, AND use WebGC (not sure anyone has tried the latter) for Julia.

I.e. closed:
https://bugs.webkit.org/show_bug.cgi?id=272004

Though still open (outdated?):
https://bugs.webkit.org/show_bug.cgi?id=247394

3 Likes