[HN Gopher] Wasm3 compiles itself (using LLVM/Clang compiled to ...
___________________________________________________________________
Wasm3 compiles itself (using LLVM/Clang compiled to WASM)
Author : theBashShell
Score : 57 points
Date : 2021-04-23 17:11 UTC (1 days ago)
(HTM) web link (twitter.com)
(TXT) w3m dump (twitter.com)
| nindalf wrote:
| For 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-territory.html...)
| Dylan16807 wrote:
| > Other webassembly runtimes are JIT based, rather than being
| interpreters.
|
| Do none of the notable ones do normal compilation?
| jedisct1 wrote:
| WAVM and SSVM do normal compilation.
| the_duke wrote:
| Some runtimes like wasmtime support AOT compilation artifacts
| that can be loaded.
|
| 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.
| TazeTSchnitzel wrote:
| What would the difference be between "JIT" and "normal"
| compilation for WebAssembly?
| smasher164 wrote:
| 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.
| Blikkentrekker wrote:
| How can a platform not support j.i.t. compilation?
|
| In what way does a platform need to cooperate with that?
| Dylan16807 wrote:
| So mostly I'm interested in compilers that compile the
| entire thing before any execution happens. Technically both
| AoT and JIT compilers can do that, but 95% of the things
| associated with "JIT" involve compiling the program one
| piece at a time.
|
| But even with the broad definition of JIT, one important
| difference is that AoT compilers don't have to mark pages
| executable.
| rubatuga wrote:
| I feel the need to repost this link:
|
| https://www.destroyallsoftware.com/talks/the-birth-and-death...
| tyingq wrote:
| 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 some huge runtime.
|
| Or forgetting the scripting languages, just the direct DOM
| access might make it less tedious to use with compiled
| languages.
|
| It's sort of a second run at getting "applets" right, but in a
| cross-language way.
| kindofajsdev wrote:
| 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.
| brokensegue wrote:
| Wasm lacks a lot of lower level system specific operations that
| the jvm offers.
| tyingq wrote:
| 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.
| vvanders wrote:
| Can confirm that Lua does run in WASM in the browser:
| https://github.com/vvanders/wasm_lua
|
| 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.
| nynx wrote:
| In a way, but wasm is designed to be a lot better at
| sandboxing.
___________________________________________________________________
(page generated 2021-04-24 23:00 UTC)