I'm a newer dev so pardon my ignorance. Is webassembly the new, more open JVM? Feels like that write once, run everywhere but this time with any(most) mainstream language.
Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
11–20 of 106 posts
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#12For those wondering, Wasm3 describes itself as "the fastest WebAssembly interpreter". Other webassembly runtimes are JIT based, rather than being interpreters. The project's readme ( https://github.com/wasm3/wasm3 ) talks more about this decision. For more on the difference, and an explanation of what JIT is, check out this section of the book Crafting Interpreters ( https://craftinginterpreters.com/a-map-of-the-terr…
> Other webassembly runtimes are JIT based, rather than being interpreters. Do none of the notable ones do normal compilation?
But in general you can't "just compile" Webassembly, because you need a runtime.
There is a C project that can compile an executable that includes the runtime and the compiled WASM, but the name is escaping me right now.
Note that JIT in the WASM world doesn't quite mean the same thing as for eg Java. Almost all runtimes compile a whole module at once, not individual functions.
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#13I'm a newer dev so pardon my ignorance. Is webassembly the new, more open JVM? Feels like that write once, run everywhere but this time with any(most) mainstream language.
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#14I'm a newer dev so pardon my ignorance. Is webassembly the new, more open JVM? Feels like that write once, run everywhere but this time with any(most) mainstream language.
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#15Earlier quoted context omitted.
What would the difference be between “JIT” and “normal” compilation for WebAssembly?
An AOT compiler would do a one-time translation to a platform-specific binary. If the environment you run on doesn’t support JIT compilation (iOS for example), AOT compiling WASM is useful.
In what way does a platform need to coöperate with that?
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#16I'm a newer dev so pardon my ignorance. Is webassembly the new, more open JVM? Feels like that write once, run everywhere but this time with any(most) mainstream language.
It seems like it's headed that way. At the moment, it's only really practical to generate WASM from compiled languages, or really small languages, like Lua. And your interfaces to the browser (and thus, the outside world) itself are pretty limited, so still lots of javascript involved.
I sometimes wonder what the world would be like if Lua had zero based indices and saw a bit broader adoption. It's such an easy language to embed/extends although QuickJS looks like it's going to give it a run for the money in the long term given the similar goals on ease of embedding.
I wonder if anyone has compiled QuickJS to WASM and run it in the browser.
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#17Earlier quoted context omitted.
An AOT compiler would do a one-time translation to a platform-specific binary. If the environment you run on doesn’t support JIT compilation (iOS for example), AOT compiling WASM is useful.
How can a platform not support j.i.t. compilation? In what way does a platform need to coöperate with that?
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#18I feel the need to repost this link: https://www.destroyallsoftware.com/talks/the-birth-and-death...
I'm somewhat curious at what pace WASM will gain "market share" while it's only practical to target it with C, C++, Rust, etc. Supposedly, there are plans to expand it to where it looks more like a virtual machine and less like ASM. Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in som…
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#19I feel the need to repost this link: https://www.destroyallsoftware.com/talks/the-birth-and-death...
I'm somewhat curious at what pace WASM will gain "market share" while it's only practical to target it with C, C++, Rust, etc. Supposedly, there are plans to expand it to where it looks more like a virtual machine and less like ASM. Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in som…
https://www.graalvm.org/reference-manual/native-image/LLVMBa...
Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
#20I feel the need to repost this link: https://www.destroyallsoftware.com/talks/the-birth-and-death...
I'm somewhat curious at what pace WASM will gain "market share" while it's only practical to target it with C, C++, Rust, etc. Supposedly, there are plans to expand it to where it looks more like a virtual machine and less like ASM. Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in som…
You might not want to bundle Rust in with C and C++ in this context. Rust is pretty accessible to developers coming from scripting languages (JavaScript, Python, etc).
Direct DOM manipulation (and the ability to send reference types across the JS-wasm boundary) is a pretty big deal though I think. Currently it doesn't make an awful lot of sense to build code that interacts with the DOM in WASM (although in Rust there are automatically generated bindings that go through a JavaScript shim).