Abstract
Code quality and compilation speed are two challenges to JIT compilers, while selective compilation is commonly used to trade-off these two issues. Meanwhile, with more and more Java applications running in mobile devices, selective compilation meets many problems. Since these applications always have flat execution profile and short live time, a lightweight JIT technique without losing code quality is extremely needed. However, the overhead of compiling stack-based Java bytecode to heterogeneous register-based machine code is significant in embedded devices. This paper presents a fast and effective JIT technique for mobile devices, building on a register-based Java bytecode format which is more similar to the underlying machine architecture. Through a comprehensive study on the characteristics of Java applications, we observe that virtual registers used by more than 90% Java methods can be directly fulfilled by 11 physical registers. Based on this observation, this paper proposes Swift, a novel JIT compiler on register-based bytecode, which generates native code for RISC machines. After mapping virtual registers to physical registers, the code is generated efficiently by looking up a translation table. And the code quality is guaranteed by the static compiler which is used to generate register-based bytecode. Besides, we design two lightweight optimizations and an efficient code unloader to make Swift more suitable for embedded environment. As the prevalence of Android, a prototype of Swift is implemented upon DEX bytecode which is the official distribution format of Android applications.
Swift is evaluated with three benchmarks (SPECjvm98, EmbeddedCaffeineMark3 and JemBench2) on two different ARM SOCs: S3C6410 (armv6) and OMAP3530 (armv7). The results show that Swift achieves a speedup of 3.13 over the best-performing interpreter on the selected benchmarks. Compared with the state-of-the-art JIT compiler in Android, JITC-Droid, Swift achieves a speedup of 1.42.
- Dalvik executable format. http://source.android.com/tech/dalvik/dex-format.html.Google Scholar
- Embeddedcaffeinemark3.0. Pendragon Software Corporation.Google Scholar
- Jazelle rct technology. ARM Ltd., http://www.arm.com/products/ processors/technologies/jazelle.php.Google Scholar
- Specjvm98. Standard Performance Evaluation Corporation.Google Scholar
- A.-R. Adl-Tabatabai, G. Langdale, S. Lucco, and R. Wahbe. Efficient and language-independent mobile programs. In Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation, PLDI '96, pages 127--136, New York, NY, USA, 1996. ACM. Google Scholar
Digital Library
- C. Badea, A. Nicolau, and A. V. Veidenbaum. A simplified java bytecode compilation system for resource-constrained embedded processors. In Proceedings of the 2007 international conference on Compilers, architecture, and synthesis for embedded systems, CASES '07, pages 218--228, New York, NY, USA, 2007. ACM. Google Scholar
Digital Library
- M. Bebenita, F. Brandner, M. Fahndrich, F. Logozzo, W. Schulte, N. Tillmann, and H. Venter. Spur: a trace-based jit compiler for cil. In Proceedings of the ACM international conference on Object oriented programming systems languages and applications, OOPSLA '10, pages 708--725, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- M. Bebenita, M. Chang, G. Wagner, A. Gal, C. Wimmer, and M. Franz. Trace-based compilation in execution environments without interpreters. In Proceedings of the 8th International Conference on the Principles and Practice of Programming in Java, PPPJ '10, pages 59--68, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: Pypy's tracing jit compiler. In Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS '09, pages 18--25, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
- D. Bornstein. Dalvik vm internals. http://sites.google.com/site/io/ dalvik-vm-internals.Google Scholar
- B. Cheng and B. Buzbee. A jit compiler for android's dalvik vm. http://www.google.com/events/io/2010/sessions/jit-compiler-androids-dalvik-vm.html.Google Scholar
- M. Cierniak, M. Eng, N. Glew, B. Lewis, and J. Stichnoth. The open runtime platform: a flexible high-performance managed runtime environment: Research articles. Concurr. Comput. : Pract. Exper., 17:617--637, April 2005. Google Scholar
Digital Library
- B. Davis, A. Beatty, K. Casey, D. Gregg, and J. Waldron. The case for virtual register machines. In Proceedings of the 2003 workshop on Interpreters, virtual machines and emulators, IVME '03, pages 41--49, New York, NY, USA, 2003. ACM. Google Scholar
Digital Library
- M. A. Ertl and D. Gregg. Optimizing indirect branch prediction accuracy in virtual machine interpreters. In Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation, PLDI '03, pages 278--288, New York, NY, USA, 2003. ACM. Google Scholar
Digital Library
- M. A. Ertl and D. Gregg. The structure and performance of efficient interpreters. Journal of Instruction-Level Parallelism, 5:2003, 2003.Google Scholar
- A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the 2009 ACM SIGPLAN conference on Programming language design and implementation, PLDI '09, pages 465--478, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
- A. Gal, C. W. Probst, and M. Franz. Hotpathvm: an effective jit compiler for resource-constrained devices. In Proceedings of the 2nd international conference on Virtual execution environments, VEE '06, pages 144--153, New York, NY, USA, 2006. ACM. Google Scholar
Digital Library
- J. Gosling. Java intermediate bytecodes. In Papers from the 1995 ACM SIGPLAN workshop on Intermediate representations, IR '95, pages 111--118, New York, NY, USA, 1995. ACM. Google Scholar
Digital Library
- S. Guo and J. Palsberg. The essence of compiling with traces. In Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '11, pages 563--574, New York, NY, USA, 2011. ACM. Google Scholar
Digital Library
- I. Hiroshi, H. Hiroshige, W. Peng, and N. Toshio. A trace-based java jit compiler retrofitted from a method-based compiler. In Proceedings of the 8th annual IEEE/ACM international symposium on Code generation and optimization, CGO '11, New York, NY, USA, 2011. ACM. Google Scholar
Digital Library
- D.-H. Jung, S.-M. Moon, and H.-S. Oh. Hybrid java compilation and optimization for digital tv software platform. In Proceedings of the 8th annual IEEE/ACM international symposium on Code generation and optimization, CGO '10, pages 73--81, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- A. Krall. Efficient javavm just-in-time compilation. In Proceedings of the 1998 International Conference on Parallel Architectures and Compilation Techniques, PACT '98, pages 205--, Washington, DC, USA, 1998. IEEE Computer Society. Google Scholar
Digital Library
- C. Krintz and B. Calder. Using annotations to reduce dynamic optimization time. SIGPLAN Not., 36:156--167, May 2001. Google Scholar
Digital Library
- C. Krintz and B. Calder. Using annotations to reduce dynamic optimization time. In Proceedings of the ACM SIGPLAN 2001 conference on Programming language design and implementation, PLDI '01, pages 156--167, New York, NY, USA, 2001. ACM. Google Scholar
Digital Library
- G. J. Myers. The case against stack-oriented instruction sets. SIGARCH Comput. Archit. News, 6:7--10, August 1977. Google Scholar
Digital Library
- M. Paleczny, C. Vick, and C. Click. The java hotspot server compiler. In In USENIX Java Virtual Machine Research and Technology Symposium, pages 1--12, 2001. Google Scholar
Digital Library
- T. H. Romer, D. Lee, G. M. Voelker, A. Wolman, W. A. Wong, J.-L. Baer, B. N. Bershad, and H. M. Levy. The structure and performance of interpreters. In Proceedings of the seventh international conference on Architectural support for programming languages and operating systems, ASPLOS-VII, pages 150--159, New York, NY, USA, 1996. ACM. Google Scholar
Digital Library
- M. Schoeberl, T. B. Preusser, and S. Uhrig. The embedded java benchmark suite jembench. In Proceedings of the 8th International Workshop on Java Technologies for Real-Time and Embedded Systems, JTRES '10, pages 120--127, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- P. U. Schulthess and E. P. Mumprecht. Reply to the case against stack-oriented instruction sets. SIGARCH Comput. Archit. News, 6:24--27, December 1977. Google Scholar
Digital Library
- Y. Shi, D. Gregg, A. Beatty, and M. A. Ertl. Virtual machine showdown: stack versus registers. In Proceedings of the 1st ACM/USENIX international conference on Virtual execution environments, VEE '05, pages 153--163, New York, NY, USA, 2005. ACM. Google Scholar
Digital Library
- T. Suganuma, T. Ogasawara, M. Takeuchi, T. Yasue, M. Kawahito, K. Ishizaki, H. Komatsu, and T. Nakatani. Overview of the ibm java just-in-time compiler. IBM Syst. J., 39:175--193, January 2000. Google Scholar
Digital Library
- G. T. Sullivan, D. L. Bruening, I. Baron, T. Garnett, and S. Amarasinghe. Dynamic native optimization of interpreters. In Proceedings of the 2003 workshop on Interpreters, virtual machines and emulators, IVME '03, pages 50--57, New York, NY, USA, 2003. ACM. Google Scholar
Digital Library
- C.-S. Wang, G. Perez, Y.-C. Chung, W.-C. Hsu, W.-K. Shih, and H.-R. Hsu. A method-based ahead-of-time compiler for android applications. In Proceedings of the 14th international conference on Compilers, architectures and synthesis for embedded systems, CASES '11, pages 15--24, New York, NY, USA, 2011. ACM. Google Scholar
Digital Library
- B.-S. Yang, S.-M. Moon, S. Park, J. Lee, S. Lee, J. Park, Y. C. Chung, S. Kim, K. Ebcioglu, and E. Altman. Latte: A java vm just-in-time compiler with fast and efficient register allocation. In Proceedings of the 1999 International Conference on Parallel Architectures and Compilation Techniques, PACT '99, pages 128--, Washington, DC, USA, 1999. IEEE Computer Society. Google Scholar
Digital Library
- A. Yermolovich, C. Wimmer, and M. Franz. Optimization of dynamic languages using hierarchical layering of virtual machines. In Proceedings of the 5th symposium on Dynamic languages, DLS '09, pages 79--88, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
- L. Zhang and C. Krintz. Adaptive code unloading for resource-constrained jvms. In Proceedings of the 2004 ACM SIGPLAN/SIGBED conference on Languages, compilers, and tools for embedded systems, LCTES '04, pages 155--164, New York, NY, USA, 2004. ACM. Google Scholar
Digital Library
- L. Zhang and C. Krintz. Profile-driven code unloading for resource-constrained jvms. In Proceedings of the 3rd international symposium on Principles and practice of programming in Java, PPPJ '04, pages 83--90. Trinity College Dublin, 2004. Google Scholar
Digital Library
Index Terms
Swift: a register-based JIT compiler for embedded JVMs
Recommendations
Swift: a register-based JIT compiler for embedded JVMs
VEE '12: Proceedings of the 8th ACM SIGPLAN/SIGOPS conference on Virtual Execution EnvironmentsCode quality and compilation speed are two challenges to JIT compilers, while selective compilation is commonly used to trade-off these two issues. Meanwhile, with more and more Java applications running in mobile devices, selective compilation meets ...
A method-based ahead-of-time compiler for android applications
CASES '11: Proceedings of the 14th international conference on Compilers, architectures and synthesis for embedded systemsThe 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 ...
Effectiveness of cross-platform optimizations for a java just-in-time compiler
OOPSLA '03: Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applicationsThis paper describes the system overview of our Java Just-In-Time (JIT) compiler, which is the basis for the latest production version of IBM Java JIT compiler that supports a diversity of processor architectures including both 32-bit and 64-bit modes, ...







Comments