Abstract
Just-in-time (JIT) compilation coupled with code caching are widely used to improve performance in dynamic programming language implementations. These code caches, along with the associated profiling data for the hot code, however, consume significant amounts of memory. Furthermore, they incur extra JIT compilation time for their creation. On Android, the current standard JIT compiler and its code caches are not shared among processes—that is, the runtime system maintains a private code cache, and its associated data, for each runtime process. However, applications running on the same platform tend to share multiple libraries in common. Sharing cached code across multiple applications and multiple processes can lead to a reduction in memory use. It can directly reduce compile time. It can also reduce the cumulative amount of time spent interpreting code. All three of these effects can improve actual runtime performance.
In this paper, we describe ShareJIT, a global code cache for JITs that can share code across multiple applications and multiple processes. We implemented ShareJIT in the context of the Android Runtime (ART), a widely used, state-of-the-art system. To increase sharing, our implementation constrains the amount of context that the JIT compiler can use to optimize the code. This exposes a fundamental tradeoff: increased specialization to a single process’ context decreases the extent to which the compiled code can be shared. In ShareJIT, we limit some optimization to increase shareability. To evaluate the ShareJIT, we tested 8 popular Android apps in a total of 30 experiments. ShareJIT improved overall performance by 9% on average, while decreasing memory consumption by 16% on average and JIT compilation time by 37% on average.
Supplemental Material
- Godmar Back, Wilson C Hsieh, and Jay Lepreau. 2000. Processes in KaffeOS: Isolation, resource management, and sharing in Java. In Proceedings of the 4th conference on Symposium on Operating System Design & Implementation-Volume 4. USENIX Association, 23. Google Scholar
Digital Library
- Robert F Berry, Donna N Dillenberger, Elizabeth A Hutchison, Susan P Paice, Donald W Schmidt, and Alan M Webb. 2004. Class sharing between multiple virtual machines. (May 18 2004). US Patent 6,738,977.Google Scholar
- Dev Bhattacharya, Kenneth B Kent, Eric Aubanel, Daniel Heidinga, Peter Shipton, and Aleksandar Micic. 2017. Improving the performance of JVM startup using the shared class cache. In Communications, Computers and Signal Processing (PACRIM), 2017 IEEE Pacific Rim Conference on. IEEE, 1–6.Google Scholar
Cross Ref
- Jacob Brock, Chen Ding, Xiaoran Xu, and Yan Zhang. 2018. PAYJIT: space-optimal JIT compilation and its practical implementation. In Proceedings of the 27th International Conference on Compiler Construction. ACM, 71–81. Google Scholar
Digital Library
- Derek Bruening and Vladimir Kiriansky. 2008. Process-shared and persistent code caches. In Proceedings of the fourth ACM SIGPLAN/SIGOPS international conference on Virtual execution environments. ACM, 61–70. Google Scholar
Digital Library
- Grzegorz Czajkowski and Laurent Daynàs. 2012. Multitasking without compromise: a virtual machine evolution. ACM SIGPLAN Notices 47, 4a (2012), 60–73. Google Scholar
Digital Library
- Grzegorz Czajkowski, Laurent Daynès, and Nathaniel Nystrom. 2002. Code sharing among virtual machines. In European Conference on Object-Oriented Programming. Springer, 155–177. Google Scholar
Digital Library
- Grzegorz Czajkowski, Laurent Daynès, and Ben L Titzer. 2003. A Multi-User Virtual Machine.. In USENIX Annual Technical Conference, General Track. 85–98. Google Scholar
Digital Library
- Laurent Daynes and Grzegorz Czajkowski. 2005. Sharing the runtime representation of classes across class loaders. In European Conference on Object-Oriented Programming. Springer, 97–120. Google Scholar
Digital Library
- L Peter Deutsch and Allan M Schiffman. 1984. Efficient implementation of the Smalltalk-80 system. In Proceedings of the 11th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. ACM, 297–302. Google Scholar
Digital Library
- Donna Dillenberger, Rajesh Bordawekar, Clarence W Clark III, Donald Durand, David Emmes, Osamu Gohda, Sally Howard, Michael F Oliver, Frank Samuel, and RW St John. 2000. Building a Java virtual machine for server applications: The JVM on OS/390. IBM Systems Journal 39, 1 (2000), 194–210. Google Scholar
Digital Library
- David Ehringer. 2010. The dalvik virtual machine architecture. (2010).Google Scholar
- Google. 2018a. Android – Android Oreo (Go edition). (2018). https://www.android.com/versions/oreo- 8- 0/go- edition/Google Scholar
- Google. 2018b. Dex Bytecode | Android Open Source Project. (2018). https://source.android.com/devices/tech/dalvik/ dalvik- bytecodeGoogle Scholar
- Google. 2018c. Dex File Format | Android Open Source Project. (2018). https://source.android.com/devices/tech/dalvik/ dex- formatGoogle Scholar
- Google. 2018d. Enable Multidex for Apps with Over 64K Methods | Android Studio. (2018). https://developer.android.com/ studio/build/multidex.htmlGoogle Scholar
- Google. 2018e. Logcat | Android Studio. (2018). developer.android.com/studio/command- line/logcat.htmlGoogle Scholar
- Google. 2018f. Low RAM Configuration | Android Open Source Project. (2018). https://source.android.com/devices/tech/ perf/low- ram#lowmemGoogle Scholar
- Lauren Guckert, Mike O’Connor, S Kumar Ravindranath, Zhuoran Zhao, and V Janapa Reddi. 2013. A case for persistent caching of compiled javascript code in mobile web browsers. In Workshop on AMAS-BT.Google Scholar
- Urs Hölzle, Craig Chambers, and David Ungar. 1991. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In European Conference on Object-Oriented Programming. Springer, 21–38. Google Scholar
Digital Library
- Yao-Chih Huang, Yu-Sheng Chen, Wuu Yang, and Jean Jyh-Jiun Shann. 2010. File-based sharing for dynamically compiled code on Dalvik virtual machine. In Computer Symposium (ICS), 2010 International. IEEE, 489–494.Google Scholar
Cross Ref
- IBM. 2018. Java Class data sharing between JVMs. (2018). https://www.ibm.com/support/knowledgecenter/en/SSYKE2_7.1. 0/com.ibm.java.lnx.71.doc/user/classdatasharing.htmlGoogle Scholar
- Hiroshi Inoue, Hiroshige Hayashizaki, Peng Wu, and Toshio Nakatani. 2011. A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler. In Proceedings of the 9th Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO ’11). IEEE Computer Society, Washington, DC, USA, 246–256. http://dl.acm.org/citation.cfm?id= 2190025.2190071 Google Scholar
Digital Library
- Kiyokuni Kawachiya, Kazunori Ogata, Daniel Silva, Tamiya Onodera, Hideaki Komatsu, and Toshio Nakatani. 2007. Cloneable JVM: a new approach to start isolated java applications faster. In Proceedings of the 3rd international conference on Virtual execution environments. ACM, 1–11. Google Scholar
Digital Library
- Thomas Kotzmann, Christian Wimmer, Hanspeter Mössenböck, Thomas Rodriguez, Kenneth Russell, and David Cox. 2008. Design of the Java HotSpotTM client compiler for Java 6. ACM Transactions on Architecture and Code Optimization (TACO) 5, 1 (2008), 7. Google Scholar
Digital Library
- Norbert Kuck, Oliver Schmidt, and Ralf Schmelter. 2009. Sharing classes and class loaders. (Nov. 3 2009). US Patent 7,614,045.Google Scholar
- Erez Landau, Dean RE Long, and Nedim Fresko. 2011. Shared JAVA jar files. (Feb. 1 2011). US Patent 7,882,198.Google Scholar
- Oracle. 2018. Java Class data sharing. (2018). https://docs.oracle.com/javase/10/vm/class- data- sharing.htmGoogle Scholar
- Michael Paleczny, Christopher Vick, and Cliff Click. 2001. The Java hotspotTM Server Compiler. In Proceedings of the 2001 Symposium on JavaTM Virtual Machine Research and Technology Symposium - Volume 1 (JVM’01). USENIX Association, Berkeley, CA, USA, 1–1. http://dl.acm.org/citation.cfm?id=1267847.1267848 Google Scholar
Digital Library
- Oliver Schmidt, Norbert Kuck, Edgar Lott, Martin Strassburger, Arno Hilgenberg, and Ralf Schmelter. 2008. Sharing objects in runtime systems. (Aug. 19 2008). US Patent 7,415,704.Google Scholar
- Toshio Suganuma, Takeshi Ogasawara, Mikio Takeuchi, Toshiaki Yasue, Motohiro Kawahito, Kazuaki Ishizaki, Hideaki Komatsu, and Toshio Nakatani. 2000. Overview of the IBM Java just-in-time compiler. ./i systems Journal 39, 1 (2000), 175–193. Google Scholar
Digital Library
- TeamAA. 2018. What is Android Go? (2018). https://www.androidauthority.com/android- go- 773037/Google Scholar
- Michael Wintergerst. 2008. Centralized cache storage for runtime systems. (Aug. 26 2008). US Patent 7,418,560.Google Scholar
- Bernard Wong, Grzegorz Czajkowski, and Laurent Daynès. 2003. Dynamically loaded classes as shared libraries: An approach to improving virtual machine scalability. In Parallel and Distributed Processing Symposium, 2003. Proceedings. International. IEEE, 10–pp. Google Scholar
Digital Library
- Yin Yan, Chunyu Chen, Karthik Dantu, Steven Y Ko, and Lukasz Ziarek. 2016. Using a multi-tasking VM for mobile applications. In Proceedings of the 17th International Workshop on Mobile Computing Systems and Applications. ACM, 93–98. Google Scholar
Digital Library
Index Terms
ShareJIT: JIT code cache sharing across processes and its practical implementation
Recommendations
PAYJIT: space-optimal JIT compilation and its practical implementation
CC 2018: Proceedings of the 27th International Conference on Compiler ConstructionJust-in-time (JIT) compilation in dynamic programming languages can improve execution speed in code with hot sections. However, that comes at the cost of increased memory usage for the storage of compiled code and associated bookkeeping data, as well as ...
Surgical precision JIT compilers
PLDI '14: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and ImplementationJust-in-time (JIT) compilation of running programs provides more optimization opportunities than offline compilation. Modern JIT compilers, such as those in virtual machines like Oracle's HotSpot for Java or Google's V8 for JavaScript, rely on dynamic ...






Comments