TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Just-in-time code generation within WebAssembly

131 pointsby nickmainalmost 3 years ago

4 comments

UncleEntityalmost 3 years ago
A lot of the stuff they’re doing with wasm is confusing to me. Compiling an interpreter to wasm to run a script in the browser seems, IDK, a bit much.<p>I’m not seeing how using the first Futamura projection (targeting wasm) wouldn’t both result in a significantly smaller module size and give more opportunity to optimize&#x2F;specialize the code as it could perform offline analysis. One could even use the second Futamura projection along with the dynamic code loading from TFA and get an online jit compiler virtually for free.<p>If I was getting paid megabucks to do these types of things that’s where I’d spend my research time.
评论 #32519066 未加载
评论 #32516718 未加载
yuri91almost 3 years ago
This is a nice overview on how to achieve just-in-time compilation in Wasm, and the demo is pretty cool. Good work!<p>We use similar techniques to power Webvm[1], an X86 Virtual Machine that runs linux programs in the browser.<p>A proper Wasm JIT API in JavaScript would be even better of course, but as the article says, cool things are already possible right now.<p>I expect to see more projects doing Wasm just-in-time compilation in the future (I believe that V86[2] also already does it)<p>[1]: <a href="https:&#x2F;&#x2F;webvm.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;webvm.io&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;copy&#x2F;v86" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;copy&#x2F;v86</a>
评论 #32513634 未加载
kristiandupontalmost 3 years ago
I experimented with this for native x86 many years ago ([link redacted]). I used it to generate BitBlt functions with no conditionals in the hot paths, which created noticeable performance improvements with no compromise in flexibility. Debugging code like that is painful though!
评论 #32514659 未加载
julosflbalmost 3 years ago
I did implement a math parser a couple of years that did JIT wasm code generation. It operated on 1d array, providing kind of numpy syntax. It achieved a very decent performance. It was quite some fun.