3 ms·
At the end it is not emulation but static recompilation (which is, arguably, cooler)
by dmitrygr 2mo ago
At the end it is not emulation but static recompilation (which is, arguably, cooler)
- throwaway27448 2mo agoHow do you differentiate the two? What is the benefit of such a distinction? Why not use eg threaded emulation vs recompiled emulation?
- dmitrygr 2mo agoEmulation visits instructions as they are executed. Static recompilation will (at translation time) visit instructions that can be discovered, even if they never run. eg: if (rand64() == 0x123456789abcdef0ull) baz = bar; an emulator will likely never visit that assignment. A static recompiler will translate it.
- throwaway27448 2mo agoHm. What is the utility of this distinction? Anyway, qemu certainly seems like it would fall under your definition of "emulator" despite obviously dynamically recompiling.
- dmitrygr 2mo agowhich is why i said "static recompiler" and not just "recompiler" distinction is that an emulator is much simpler, while a static recompiler is a lot more work and thus ~30% more cool
- throwaway27448 2mo agoAh. I admit I've only ever made dynamic recompilers
- monocasa 2mo agoIDK, a lot of the emulators I've seen and a couple I've written will visit that. Not everything is built on simple traces, but a lot of the time will translate more complex graphs at a time.
- drunken_thor 2mo agoIn my limited understanding, static recompiling is like JIT transpilation from one arch to another where emulation runs each instruction calling behaviour depending on the instruction. As for tradeoffs my knowledge is not wide enough to declare anything certain.
- throwaway27448 2mo agoWhat is the distinction in your mind? Can recompiling not call each instruction? Can threaded interpretation not perform optimization?
- shuklaayush 2mo agoYeah, I went back and forth on the title. It's definitely not an interpreter. I still think of emulation as the umbrella term though, running code for one architecture on another, with interpretation and dynamic/static recompilation being different ways to get there