Dalvik virtual machine
From Wikipedia, the free encyclopedia
Dalvik is a major piece of Google's Android platform for mobile devices. The virtual machine runs Java platform applications which have been converted into a compact Dalvik Executable (.dex) format suitable for systems that are constrained in terms of memory and processor speed. It was written by Dan Bornstein, who named it after the fishing village of Dalvík in Eyjafjörður, Iceland, where some of his ancestors lived.[1][2]
Unlike most virtual machines and true Java VMs which are stack machines, the Dalvik VM is a register-based architecture. Like the CISC vs. RISC debate, the relative merits of these two approaches is a subject of continuous argument but the underlying technology sometimes blurs the ideological boundaries. Moreover, the relative advantages of the two approaches depend on the interpretation/compilation strategy chosen. Generally, however, stack based machines must use instructions to load data on the stack and manipulate that data and thus require more instructions than register machines to implement the same high level code. However, the instructions in a register machine must encode the source and destination registers and therefore tend to be larger. This difference is primarily of importance to VM interpreters for whom opcode dispatch tends to be expensive and other factors are relevant for JIT compilation.
A tool called dx is used to convert Java .class files into the .dex format. Multiple classes are included in a single .dex file. Duplicate strings and other constants used in multiple class files are included only once in the .dex output to conserve space. Java bytecode is also converted into an alternate instruction set used by the Dalvik VM. An uncompressed .dex file is typically a few percent smaller in size than a compressed .jar (Java Archive) derived from the same .class files.
The Dalvik executables may be modified again when they get installed onto a mobile device. In order to gain further optimizations, byte order may be swapped in certain data, simple data structures and functions libraries may be linked inline, and empty class objects may be short-circuited, for example.
Being optimized for low memory requirements, Dalvik has some specific characteristics that differentiate it from other standard VMs[3]:
- The VM was slimmed down to use less space.
- Dalvik has no Just-in-time compiler
- The constant pool has been modified to use only 32-bit indexes to simplify the interpreter.
- It uses its own bytecode, not Java bytecode.
[edit] References
- ^ Journal entry
- ^ "Google Calling: Inside Android, the gPhone SDK". onlamp.com. http://www.onlamp.com/pub/a/onlamp/2007/11/12/google-calling-inside-the-gphone-sdk.html. Retrieved on 2008-02-05.
- ^ Rose, John (2008-05-31). "with Android and Dalvik at Google I/O". http://blogs.sun.com/jrose/entry/with_android_and_dalvik_at. Retrieved on 2008-06-08.
[edit] External links
- Dalvik overview
- Dalvik: how Google routed around Sun's IP-based licensing restrictions on Java ME
- Google and Sun may butt heads over Android
- Dex File Format
- The town of Dalvik celebrates its namesake
- Dalvik VM Internals - Presentation from Google I/O
This computer software article is a stub. You can help by expanding it. |