5

Since the new ART runtime is compiling the apps AOT, I was wondering whether running an app still includes a virtual machine, or the code is executed directly on the system. I haven't been able to extract this information from articles around the web as some mention a virtual machine, where other talks about the apps being compiled to ELF files (to my knowledge, the binary format used by the Linux kernel suggesting that the apps are run natively).
Can anyone help me out on this?
BPou

4

Short story: yes, ART translates apps to code native to the actual phone's architecture and therefore apps execute natively without the need of a JIT compiler.

Long story: For reasons of compatibility, applications are still bundled in apks carrying the java code compiled into dex files. But instead of just optimizing the .dex code and executing it inside Dalvik VM (DVM), the code is compiled down to native code. This is done on the device using a tool called dex2oat, where oat files are embedded within the regular ELF file format.

The following figure depicts the difference between the usage of DVM and ART:

Diagram of the Android Run Time architecture, recreated from information published at A Closer Look at Android RunTime (ART) in Android L. (http://anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/) (Wikipedia: Diagram of the Android Run Time architecture, recreated from information published at A Closer Look at Android RunTime (ART) in Android L.)

The performance improvement comes from the fact that the DVM used JIT compilation each and every time an app is executed, while AOT compilation only happens at install time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.