skip to main content
research-article
Open Access

ShareJIT: JIT code cache sharing across processes and its practical implementation

Published:24 October 2018Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

a124-xu.webm

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarCross RefCross Ref
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. Grzegorz Czajkowski and Laurent Daynàs. 2012. Multitasking without compromise: a virtual machine evolution. ACM SIGPLAN Notices 47, 4a (2012), 60–73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. David Ehringer. 2010. The dalvik virtual machine architecture. (2010).Google ScholarGoogle Scholar
  13. Google. 2018a. Android – Android Oreo (Go edition). (2018). https://www.android.com/versions/oreo- 8- 0/go- edition/Google ScholarGoogle Scholar
  14. Google. 2018b. Dex Bytecode | Android Open Source Project. (2018). https://source.android.com/devices/tech/dalvik/ dalvik- bytecodeGoogle ScholarGoogle Scholar
  15. Google. 2018c. Dex File Format | Android Open Source Project. (2018). https://source.android.com/devices/tech/dalvik/ dex- formatGoogle ScholarGoogle Scholar
  16. Google. 2018d. Enable Multidex for Apps with Over 64K Methods | Android Studio. (2018). https://developer.android.com/ studio/build/multidex.htmlGoogle ScholarGoogle Scholar
  17. Google. 2018e. Logcat | Android Studio. (2018). developer.android.com/studio/command- line/logcat.htmlGoogle ScholarGoogle Scholar
  18. Google. 2018f. Low RAM Configuration | Android Open Source Project. (2018). https://source.android.com/devices/tech/ perf/low- ram#lowmemGoogle ScholarGoogle Scholar
  19. 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 ScholarGoogle Scholar
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarCross RefCross Ref
  22. 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 ScholarGoogle Scholar
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. Norbert Kuck, Oliver Schmidt, and Ralf Schmelter. 2009. Sharing classes and class loaders. (Nov. 3 2009). US Patent 7,614,045.Google ScholarGoogle Scholar
  27. Erez Landau, Dean RE Long, and Nedim Fresko. 2011. Shared JAVA jar files. (Feb. 1 2011). US Patent 7,882,198.Google ScholarGoogle Scholar
  28. Oracle. 2018. Java Class data sharing. (2018). https://docs.oracle.com/javase/10/vm/class- data- sharing.htmGoogle ScholarGoogle Scholar
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle Scholar
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. TeamAA. 2018. What is Android Go? (2018). https://www.androidauthority.com/android- go- 773037/Google ScholarGoogle Scholar
  33. Michael Wintergerst. 2008. Centralized cache storage for runtime systems. (Aug. 26 2008). US Patent 7,418,560.Google ScholarGoogle Scholar
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. ShareJIT: JIT code cache sharing across processes and its practical implementation

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            Full Access

            • Published in

              cover image Proceedings of the ACM on Programming Languages
              Proceedings of the ACM on Programming Languages  Volume 2, Issue OOPSLA
              November 2018
              1656 pages
              EISSN:2475-1421
              DOI:10.1145/3288538
              Issue’s Table of Contents

              Copyright © 2018 Owner/Author

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 24 October 2018
              Published in pacmpl Volume 2, Issue OOPSLA

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!