Dynamic recompilation
Program execution |
---|
General concepts |
Types of code |
Compilation strategies |
Notable runtimes |
|
Notable compilers & toolchains |
|
In computer science, dynamic recompilation 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.
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 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 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
- Many Java virtual machines feature dynamic recompilation.
- Apple's 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.
- The HP Dynamo project, an example of a transparent binary dynamic optimizer.[1]
- DynamoRIO, an open-source successor to Dynamo that works with the ARM, x86-64 and IA-64 (Itanium) instruction sets.[2][3]
- The Vx32 virtual machine employs dynamic recompilation to create OS-independent x86 architecture sandboxes for safe application 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.[4]
- The backwards compatibility functionality of the Xbox 360 (i.e. running games written for the original 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.
Emulators
- PCSX2,[5] a PlayStation 2 emulator, has a recompiler called "microVU", the successor of "SuperVU".
- GCemu,[6] a GameCube emulator.
- GEM,[7] a Game Boy emulator for MSX uses an optimizing dynamic recompiler.
- DeSmuME,[8] a Nintendo DS emulator, has a dynarec option.
- Soywiz's Psp,[9] a PlayStation Portable emulator, has a dynarec option.
- Mupen64Plus, a multi-platform Nintendo 64 emulator.[10]
- Yabause, a multi-platform Saturn emulator.[11]
- PPSSPP, a multi-platform PlayStation Portable emulator, uses a JIT dynamic recompiler by default.[12]
See also
- Binary recompiler
- Binary translation
- Comparison of platform virtualization software
- Just-in-time compilation
- Instrumentation (computer programming)
References
- ↑ "HP Labs' technical report on Dynamo". http://www.hpl.hp.com/techreports/1999/HPL-1999-77.html.
- ↑ "DynamoRIO Dynamic Instrumentation Tool Platform". http://www.dynamorio.org/home.html.
- ↑ "DynamoRIO". 15 October 2021. https://github.com/DynamoRIO/dynamorio.
- ↑ Paul, Matthias R.; Frinke, Axel C. (1997-10-13), FreeKEYB - Enhanced DOS keyboard and console driver (v6.5 ed.)
- ↑ "PCSX 2". http://www.pcsx2.net/.
- ↑ petebernert (3 October 2015). "GCemu". SourceForge. http://sourceforge.net/projects/gcemu-project.
- ↑ "Gameboy Emulator for MSX | The New Image". GEM. http://gem.tni.nl/.
- ↑ "DeSmuME v0.9.9". http://desmume.org/2013/04/30/desmume-0-9-9-released/.
- ↑ Publicado por Carlos Ballesteros Velasco (2013-07-28). "Soywiz's PSP Emulator: Release : Soywiz's Psp Emulator 2013-07-28 (r525)". Pspemu.soywiz.com. http://pspemu.soywiz.com/2013/07/release-soywizs-psp-emulator-2013-07-28.html.
- ↑ Mupen64Plus
- ↑ "SH2". http://wiki.yabause.org/index.php5?title=SH2_dynamic_recompiler.
- ↑ "PPSSPP - PPSSPP - PSP emulator for Android, Windows, Linux, iOS, MacOSX". https://ppsspp.org/.
External links
Original source: https://en.wikipedia.org/wiki/Dynamic recompilation.
Read more |