-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request: Make TCG create Webassembly instead of using TCI #16
Comments
As of today, WebAssembly is not designed to do JIT compilation [1]. Every recompiled Translation Block (TB) of TCG, needs results in a new WebAssembly module. This has quite a significant performance overhead on most browsers, with Firefox being the most reliable of them all. Chrome's engine reserves 4 GiB of virtual address space for every WebAssembly module so theoretically it can only handle 4096 WebAssembly modules before crashing which is certainly not enough for us. That said, we already have the code, and TCG-WASM translation is slightly faster (on benchmarks), and the code is slightly simpler, but the bottleneck is still the WASM engines in browsers. It seems, @atrosinenko solved this issue by interpreting TBs (at Binaryen level!) that are not frequently used. We haven't written anything like that yet, but if JIT keeps being delayed from the WASM specification, then we will (though relying on TCI rather than interpreting WASM bytecode). We will probably release the code soon so stay tuned! I'll update this thread when we're ready. |
That sounds good! Looking very much forward to the new release. My use case is a very simple one. I've tested unicorn.js for running 4klang in the browser. It works fine, and your api is great, but interpretation is too slow for generating audio in real time. However this code is so small that I don't think it should generate lot's of TBs and maybe what you have already is sufficient for running this. Thank you for the great work in porting unicorn to the browser! |
As @atrosinenko has achieved with https://github.com/atrosinenko/qemujs, it would be great to have just in time compilation to webassembly instead of using the TCI interpreter.
The text was updated successfully, but these errors were encountered: