by samwillis · 4y ago · 0 comments
Slight aside, with the incredible performance possible with Rosetta on Apple silicone, what are the chances of using it as part of a virtual machine emulating x86-64 with similar performance? I understand that Rosetta “recompiles” to ARM which would probably be harder with a VM but I think it also does real-time conversion to. I have no idea about he details but could QEMU use Rosetta under the hood for emulation?
As long as that is available, it seems like third-party virtualization software could get similar performance to Rosetta, and potentially experiment with attempting to support system-level CPU emulation.
The thing is, it only supports windows xp + windows 7, and not 8/10/11 (those are supported as arm64). Apparently the amount of work is massive (so are performance hits for the Windows XP/7 when you run it).
It's one thing to emulate apps, another entirely to emulate whole advanced OS.
> the performance penalty is significant
I was asking the genuine question as to if it would be theoretically possible to use Rosetta as part of the emulation for a VM to potentially help it to perform better?
For example could a tool be installed within a guest OS that effectively send binaries to Rosetta for translation before execution?
It just seems to me that if Apple have done such an incredible job with Rosetta wouldn’t it be brilliant if it was possible to use that within an emulated VM on Apple silicone.
Att the app level rosetta can operate at link time (yes it does AoT, but that's essentially just caching), where it knows things like what things are text regions, what the entry points are, it can assume that the code is "correct" (if your code is buggy natively, then rosetta won't stop it going wrong), etc.
System level emulation means rosetta (or whatever) loses that transparency, so can't precompile, and can't make any assumptions about code behaving properly. To get an idea of what the performance impact is you should check the performance of JIT compiled code under rosetta. Rosetta ensures that the JIT will work, but the perf hit is staggering. System level emulation basically means treating everything as being JIT code.
I'm sure a system level emulator (Qemu?) could do better than for example just slapping a system emulator mode into rosetta, but that would be because rosetta is optimized for app level emulation.