The time the x86 emulator team found code so bad they fixed it during emulation
5 hours ago
- #emulator history
- #binary translation
- #compiler optimization
- A colleague shared a story about an early Windows processor emulator for x86-32 using binary translation for performance.
- A program required allocating and initializing 64KB of stack memory, typically done with a stack probe and a tight loop.
- The compiler instead unrolled the loop into 65,536 separate write instructions, using 256KB of code to initialize 64KB of data.
- The emulator team added special detection in the translator to replace this inefficient function with a compact loop.