A method-based ahead-of-time compiler for Android applications

The execution environment of Android system is based on a virtual machine called Dalvik virtual machine (DVM) in which the execution of an application program is in interpret-mode. To reduce the interpretation overhead of DVM, Google has included a trace-based just-in-time compiler (JITC) in the latest version of Android. Due to limited resources and the requirement for reasonable response time, the JITC is unable to apply deep optimizations to generate high quality code. In this paper, we propose a method-based ahead-of-time compiler (AOTC), called Icing, to speed up the execution of Android applications without the modification of any components of Android framework. The main idea of Icing is to convert the hot methods of an application program from DEX code to C code and uses the GCC compiler to translate the C code to the corresponding native code. With the Java Native Interface (JNI) library, the translated native code can be called by DVM. Both AOTC and JITC have their strength and weakness. In order to combine the strength and avoid the weakness of AOTC and JITC, in Icing, we have proposed a cost model to determine whether a method should be handled by AOTC or JITC during profiling. To evaluate the performance of Icing, four benchmarks used by Google JITC are used as test cases. The performance results show that, with Icing, the execution time of an application is two to three times faster than that without JITC, and 25% to 110% faster than that with JITC.

[1]  John H. Hartman,et al.  Toba: Java for Applications - A Way Ahead of Time (WAT) Compiler , 1997, COOTS.

[2]  Andrew W. Appel,et al.  Modern Compiler Implementation in Java: Static Single-Assignment Form , 2002 .

[3]  Masataka Sassa,et al.  Static Single Assignment Form in the COINS Compiler Infrastructure , 2003 .

[4]  Soo-Mook Moon,et al.  Java client ahead-of-time compiler for embedded systems , 2007, LCTES '07.

[5]  Fridtjof Siebert,et al.  TurboJ, a Java Bytecode-to-Native Compiler , 1998, LCTES.

[6]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.

[7]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[8]  Charles Consel,et al.  Harissa: A Flexible and Efficient Java Environment Mixing Bytecode and Compiled Code , 1997, COOTS.

[9]  Shuvra S. Bhattacharyya,et al.  Java-through-C compilation: an enabling technology for Java in embedded systems , 2004, Proceedings Design, Automation and Test in Europe Conference and Exhibition.

[10]  Angela Demke Brown,et al.  Inlining java native calls at runtime , 2005, VEE '05.

[11]  Chandra Krintz Coupling on-line and off-line profile information to improve program performance , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[12]  Chandra Krintz,et al.  Using annotations to reduce dynamic optimization time , 2001, PLDI '01.

[13]  Laurie Hendren,et al.  Soot: a Java bytecode optimization framework , 2010, CASCON.