Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dynamic recompilation
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|On-the-fly translation of code between CPUs}} {{Multiple issues| {{More citations needed|date=January 2014}} {{Weasel|date=January 2014}} {{Original research|date=June 2021}} {{Lead too short|date=June 2021}} }} {{Use dmy dates|date=July 2019|cs1-dates=y}} {{Program execution}} In [[computer science]], '''dynamic recompilation''' is a feature of some [[emulator]]s and [[virtual machine]]s, where the system may [[Compiler|recompile]] some part of a [[Computer program|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]]. ==Uses== Most dynamic recompilers are used to convert machine code between architectures at runtime. This is a task often needed in the emulation of legacy gaming platforms. In other cases, a system may employ dynamic recompilation as part of an [[adaptive optimization]] strategy to execute a portable program representation such as [[Java (programming language)|Java]] or .NET [[Common Language Runtime]] bytecodes. Full-speed debuggers also utilize dynamic recompilation to reduce the space overhead incurred in most [[deoptimization]] techniques, and other features such as dynamic [[thread migration]]. ==Tasks== The main tasks a dynamic recompiler has to perform are: * Reading in machine code from the source platform * Emitting machine code for the target platform A dynamic recompiler may also perform some auxiliary tasks: * Managing a [[cache (computing)|cache]] of recompiled code * Updating of elapsed cycle counts on platforms with cycle count registers * Management of [[interrupt]] checking * Providing an interface to virtualized support hardware, for example a [[GPU]] * Optimizing higher-level code structures to run efficiently on the target hardware (see below) ==Applications== {{example farm|date=June 2021}} * Many [[Java virtual machine]]s feature dynamic recompilation. * Apple's [[Rosetta (software)|Rosetta]] for [[Mac OS X]] on x86, allows [[PowerPC]] code to be run on the [[x86 architecture]]. * Later versions of the [[Mac 68K emulator]] used in [[classic Mac OS]] to run [[680x0]] code on the PowerPC hardware. * [[Psyco]], a [[specializing compiler]] for [[Python (programming language)|Python]]. * The HP [[Dynamo project]], an example of a transparent binary dynamic [[Compiler optimization|optimizer]].<ref name="HP_1999_Dynamo">{{cite web|url=http://www.hpl.hp.com/techreports/1999/HPL-1999-77.html|title=HP Labs' technical report on Dynamo|access-date=2006-01-22 |archive-date=2008-07-07 |archive-url=https://web.archive.org/web/20080707003649/http://www.hpl.hp.com/techreports/1999/HPL-1999-77.html|url-status=dead}}</ref> * [[DynamoRIO]], an [[open-source software|open-source]] successor to Dynamo that works with the [[ARM architecture|ARM]], [[x86-64]] and [[IA-64]] (Itanium) instruction sets.<ref>{{Cite web |url=http://www.dynamorio.org/home.html |title=DynamoRIO Dynamic Instrumentation Tool Platform |access-date=2016-04-12 |archive-date=2019-09-05 |archive-url=https://web.archive.org/web/20190905070811/http://www.dynamorio.org/home.html |url-status=dead }}</ref><ref>{{Cite web|url=https://github.com/DynamoRIO/dynamorio|title = DynamoRIO|website = [[GitHub]]|date = 15 October 2021}}</ref> * The [[Vx32|Vx32 virtual machine]] employs dynamic recompilation to create [[operating system|OS]]-independent x86 architecture sandboxes for safe application [[Plug-in (computing)|plugins]]. * [[Microsoft Virtual PC]] for Mac, used to run x86 code on PowerPC. * FreeKEYB, an international DOS keyboard and console driver with many usability enhancements utilized [[self-modifying code]] and [[dynamic dead code elimination]] to minimize its in-memory image based on its user configuration (selected features, languages, layouts) and actual runtime environment (OS variant and version, loaded drivers, underlying hardware), automatically resolving dependencies, dynamically relocating and recombining code sections on byte-level granularity and optimizing opstrings based on semantic information provided in the source code, relocation information generated by special tools during assembly and profile information obtained at load time.<ref name="Paul_1997_FreeKEYB">{{citation |title=FreeKEYB - Enhanced DOS keyboard and console driver |edition=v6.5 |first1=Matthias R. |last1=Paul |first2=Axel C. |last2=Frinke |type=User Manual |date=1997-10-13 |orig-year=first published 1991}}</ref> * The backwards compatibility functionality of the [[Xbox 360]] (i.e. running games written for the original [[Xbox (console)|Xbox]]) is widely assumed to use dynamic recompilation. * Apple's [[Rosetta 2]] for Apple silicon, permits many applications compiled for [[x86-64]]-based processors to be translated for execution on Apple silicon. * [[QEMU]] ===Emulators=== * [[PCSX2]],<ref>{{cite web|url=http://www.pcsx2.net/|title=PCSX 2|access-date=2009-04-15 |archive-date=2005-10-29 |archive-url=https://web.archive.org/web/20051029050226/http://www.pcsx2.net/|url-status=dead}}</ref> a [[PlayStation 2]] emulator, has a recompiler called "microVU", the successor of "SuperVU". * GCemu,<ref>{{cite web|url=http://sourceforge.net/projects/gcemu-project|title=GCemu|author=petebernert|work=SourceForge|date=3 October 2015 }}</ref> a [[GameCube]] emulator. * GEM,<ref>{{cite web|url=http://gem.tni.nl/ |title=Gameboy Emulator for MSX | The New Image |publisher=GEM |access-date=2014-01-12}}</ref> a [[Game Boy]] emulator for [[MSX]] uses an optimizing dynamic recompiler. * DeSmuME,<ref>{{cite web|url=http://desmume.org/2013/04/30/desmume-0-9-9-released/|title=DeSmuME v0.9.9}}</ref> a [[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 |access-date=2014-01-12}}</ref> a [[PlayStation Portable]] emulator, has a dynarec option. * [[Mupen64Plus]], a multi-platform Nintendo 64 emulator.<ref>[http://pandorawiki.org/Mupen64plus_dynamic_recompiler Mupen64Plus]</ref> * Yabause, a multi-platform [[Sega Saturn|Saturn]] emulator.<ref>{{cite web|url=http://wiki.yabause.org/index.php5?title=SH2_dynamic_recompiler|title=SH2}}</ref> *[[PPSSPP]], a multi-platform [[PlayStation Portable]] emulator, uses a [[Just-in-time compilation|JIT]] dynamic recompiler by default.<ref>{{Cite web|title=PPSSPP - PPSSPP - PSP emulator for Android, Windows, Linux, iOS, MacOSX|url=https://ppsspp.org/|access-date=2021-11-17|website=ppsspp.org}}</ref> * [[PCem]], a emulator for old pc platforms which can be used on Windows and Linux. It uses the recompiler to translate legacy cpu calls to modern cpu instructions and to gain some speed in emulation overall. * [[86Box]], a fork of PCem with the goal of a more accurate emulation. It is using the recompiler for the same purpose. ==See also== * [[Binary recompiler]] * [[Binary translation]] * [[Comparison of platform virtualization software]] * [[Just-in-time compilation]] * [[Instrumentation (computer programming)]] ==References== {{Reflist}} ==External links== * [http://www.multigesture.net/wp-content/uploads/mirror/zenogais/Dynamic%20Recompiler.html Dynamic recompiler tutorial]. [https://web.archive.org/web/20210611125440/http://www.multigesture.net/wp-content/uploads/mirror/zenogais/Dynamic%20Recompiler.html Archive] at the [[Wayback Machine]] (archived {{date|2021-06-11|DMY}}). * [https://web.archive.org/web/20170201173933/http://emulatemii.com/wordpress/?tag=dynarec Blog posts about writing a MIPS to PPC dynamic recompiler]. [[Category:Virtualization]] [[Category:Compiler construction]] [[Category:Emulation software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite web
(
edit
)
Template:Date
(
edit
)
Template:Example farm
(
edit
)
Template:Multiple issues
(
edit
)
Template:Program execution
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use dmy dates
(
edit
)