3 ms·
Nope. First line from Wikipedia[1]: Rosetta is a dynamic binary translator developed by Apple Inc. for macOS… Follow the link for Dynamic Binary Translator[2
by alwillis 6y ago
Nope.
First line from Wikipedia[1]:
Rosetta is a dynamic binary translator developed by Apple Inc. for macOS…
Follow the link for Dynamic Binary Translator[2]:
Dynamic binary translation (DBT) looks at a short sequence of code—typically on the order of a single basic block—then translates it and caches the resulting sequence. Code is only translated as it is discovered and when possible, and branch instructions are made to point to already translated and saved code (memoization).
Dynamic binary translation differs from simple emulation (eliminating the emulator's main read-decode-execute loop—a major performance bottleneck), paying for this by large overhead during translation time. This overhead is hopefully amortized as translated code sequences are executed multiple times.
[1]: https://en.wikipedia.org/wiki/Rosetta_(software) https://en.wikipedia.org/wiki/Rosetta_(software)
[2]: https://en.wikipedia.org/wiki/Binary_translation#Dynamic_binary_translation https://en.wikipedia.org/wiki/Binary_translation#Dynamic_bin...
- saagarjha 6y agoBelieve me, I know how Rosetta works. You don't need to quote Wikipedia at me ;) Rosetta absolutely is an emulator, which has traditionally referred to taking code from one CPU architecture and making it run on another (in contrast with taking a binary of the same architecture but running it in another environment, which is often called a "compatibility layer" or in Apple's terms a "simulator", or the hardware-assisted version of this which is virtualization). There are many ways to write the part of an emulator that mimics another CPU; the simplest is an interpreter loop, but there's ahead-of-time and just-in-time code generation techniques as well. Dynamic binary translation is quite simple, as your quote mentions; Rosetta 2 instead achieves its performance through a combination of static binary translation to a form amenable to its runtime. Things that it cannot translate go through a fairly advanced optimizing JIT that goes way beyond what a dynarec would typically do.