Dynamic recompilation: Difference between revisions
mNo edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
'''Dynamic recompilation''' (sometimes abbreviated to '''dynarec''' or '''DRC''') is a feature of some emulators and virtual machines, where the system may recompile some part of a program ''during execution''. By compiling during execution, the system can tailor the generated code to reflect the program's run-time environment, and potentially produce more efficient code by exploiting information that is not available to a traditional static compiler. | '''Dynamic recompilation''' (sometimes abbreviated to '''dynarec''' or '''DRC''') is a feature of some emulators and virtual machines, where the system may recompile some part of a program ''during execution''. By compiling during execution, the system can tailor the generated code to reflect the program's run-time environment, and potentially produce more efficient code by exploiting information that is not available to a traditional static compiler. | ||
==Accuracy and Relationship with Interpreters== | |||
While dynamic recompilers offer immense performance benefits over standard execution methods, a common misconception is that an interpreter is inherently "more accurate" than a recompiler. In reality, interpretation and recompilation are simply different execution strategies. | |||
Interpreters generally achieve higher accuracy earlier in development because their execution model is more flexible and straightforward to debug. However, if a development team focuses heavily on optimization and edge cases within the recompiler while neglecting the interpreter, the interpreter can become less accurate over time. | |||
In modern emulation software development, this imbalance is rare. Most development teams maintain a robust interpreter to serve as a baseline reference model. When bugs appear in the recompiled code, developers use the interpreter's behavior to pinpoint and fix flaws in the recompiler's logic: a relationship highly analogous to using a pixel-accurate software renderer to debug a high-performance hardware renderer. | |||
==Uses== | ==Uses== | ||