News for hackers. Stuff that matters.
Re:Show HN: Docker in the browser using x86-to-WASM recompil... by s-macke on Tuesday November 01, 2022 @02:34PM (#33425421)
Can you explain in more detail how this recompilation works? When is it triggered? Because your emulator is still very slow, and recompiling doesn't seem to help. A wiki or blog post would be helpful.
Re:Show HN: Docker in the browser using x86-to-WASM recompil... by g3 on Tuesday November 01, 2022 @04:37PM (#33427144)
Yes, I should write about v86's internals some day. Meanwhile, the code is right here: https://github.com/copy/v86/tree/master/src/rust

It's much faster with recompilation than without, but I agree that it's slower than expected (compared to, for example, qemu-tcg).

There is still room for improvements (e.g. eflags updates, 16-bit instructions, call/ret optimisations, main loop), but part of the problem is limitations of web assembly (no mmap, only structured control flow) and browser engines (memory blow up on large generated wasm modules, related to control flow).

The webvm folks explain the control flow problem quite well, and seem to be doing a better job than v86: https://medium.com/leaningtech/extreme-webassembly-1-pushing...