Dynamic recompilation: Difference between revisions

Tags: Mobile edit Mobile web edit
Ahayri (talk | contribs)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{for|more|High and low-level emulation#Modern Dependencies, Advancements and Optimization Strategies}}
'''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.


{{Main|wikipedia:Dynamic recompilation}}
==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==
Line 61: Line 68:


There is an immediate speed benefit simply because the processor doesn't have to load so many instructions to do the same task, but also because the movs instruction is likely to be optimized by the processor designer to be more efficient than the sequence used in the first example. (For example, it may make better use of parallel execution in the processor to increment A and B while it is still copying bytes).
There is an immediate speed benefit simply because the processor doesn't have to load so many instructions to do the same task, but also because the movs instruction is likely to be optimized by the processor designer to be more efficient than the sequence used in the first example. (For example, it may make better use of parallel execution in the processor to increment A and B while it is still copying bytes).
===Gaming===
*[[MAME]] uses dynamic recompilation in its CPU emulators for MIPS, SuperH, PowerPC and even the Voodoo graphics processing units.
*[[1964]], an open-source [[Nintendo 64 emulators|Nintendo 64 emulator]] for [[wikipedia:x86|x86]] hardware.
*Wii64, a [[Nintendo 64 emulators|Nintendo 64 emulator]] for the Nintendo Wii.
*WiiSX, a Sony PlayStation emulator for the Nintendo Wii.
*[[Mupen64Plus]], an open-source, multi-platform, plugin-based Nintendo 64 emulator.<ref>[http://pandorawiki.org/Mupen64plus_dynamic_recompiler Mupen64Plus]</ref>
*[[Yabause]], an open-source multi-platform [[Sega Saturn emulators|Sega Saturn emulator]].<ref>[http://wiki.yabause.org/index.php5?title=SH2_dynamic_recompiler SH2]</ref>
*The backwards compatibility functionality of the [[Xbox 360 emulators|Xbox 360]] (i.e. running games written for the original [[Xbox emulators|Xbox]]) is widely assumed to use dynamic recompilation.
*[[PPSSPP]], an open-source, multi-platform [[PlayStation Portable emulators|Sony PlayStation Portable emulator]]. Recompilers for both x86 and ARM.
*PSEmu Pro, a [[PlayStation emulators|Sony PlayStation emulator]].
*[[UltraHLE]], the first [[Nintendo 64 emulators|Nintendo 64 emulators]] emulator to fully run commercial games.
*[[PCSX2]],<ref>[http://www.pcsx2.net PCSX2]</ref> an open-source, plugin-based [[PlayStation 2 emulators|Sony PlayStation 2 emulator]], has a recompiler called "microVU", the successor of "SuperVU".
*[[Dolphin]], an open-source [[GameCube emulators|Nintendo GameCube]] and [[Wii emulators|Wii emulator]], has a dynarec option.
*GCEmu,<ref>[http://sourceforge.net/projects/gcemu-project GCEmu]</ref> a [[GameCube emulators|Nintendo GameCube emulator]].
*[[nullDC]], an open-source [[Sega Dreamcast emulators|Sega Dreamcast]] and [[Sega NAOMI and variants|NAOMI emulator]] for [[wikipedia:x86|x86]].
*GEM,<ref>{{cite web|url=http://gem.tni.nl/ |title=Gameboy Emulator for MSX &#124; The New Image |publisher=GEM |date= |accessdate=2014-01-12}}</ref> a [[Game Boy/Game Boy Color emulators|Nintendo Game Boy/Color]] emulator for [[MSX emulators|MSX]] uses an optimizing dynamic recompiler.
*[[DeSmuME]],<ref>[http://desmume.org/2013/04/30/desmume-0-9-9-released/ DeSmuME v0.9.9]</ref> an open-source [[Nintendo DS emulators|Nintendo DS emulator]], has a dynarec option.
*Soywiz's Psp,<ref>{{cite web|author=Publicado por Carlos Ballesteros Velasco |url=http://pspemu.soywiz.com/2013/07/release-soywizs-psp-emulator-2013-07-28.html |title=Soywiz's PSP Emulator: Release : Soywiz's Psp Emulator 2013-07-28 (r525) |publisher=Pspemu.soywiz.com |date=2013-07-28 |accessdate=2014-01-12}}</ref> a [[PlayStation Portable emulators|Sony PlayStation Portable emulator]], has a dynarec option.


==See also==
==See also==
Line 93: Line 81:
*[http://web.archive.org/web/20051018182930/www.zenogais.net/Projects/Tutorials/Dynamic%20Recompiler.html Dynamic recompiler tutorial]
*[http://web.archive.org/web/20051018182930/www.zenogais.net/Projects/Tutorials/Dynamic%20Recompiler.html Dynamic recompiler tutorial]
*[http://emulatemii.com/wordpress/?tag=dynarec Blog posts about writing a MIPS to PPC dynamic recompiler]
*[http://emulatemii.com/wordpress/?tag=dynarec Blog posts about writing a MIPS to PPC dynamic recompiler]
*[https://llvm.org/ LLVM]
*[https://www.phoronix.com/news/TPDE-Faster-Compile-Than-LLVM TPDE]


[[Category:Wikipedia copies]]
[[Category:Wikipedia copies]]