skip to main content
research-article
Open access

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

Published: 24 October 2018 Publication History

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.

Supplementary Material

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

Cited By

View all
  • (2024)An Analysis of Compiled Code Reusability in Dynamic CompilationProceedings of the 16th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3689490.3690406(43-53)Online publication date: 17-Oct-2024
  • (2023)Automatically Generated Supernodes for AST Interpreters Improve Virtual-Machine PerformanceProceedings of the 22nd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3624007.3624050(1-13)Online publication date: 22-Oct-2023
  • (2023)Reusing Just-in-Time Compiled CodeProceedings of the ACM on Programming Languages10.1145/36228397:OOPSLA2(1176-1197)Online publication date: 16-Oct-2023
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
This work is licensed under a Creative Commons Attribution-NoDerivs International 4.0 License.

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 for this article.

Check for updates

Author Tags

  1. Android Runtime System
  2. Code Cache Sharing
  3. JIT Compilation

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)238
  • Downloads (Last 6 weeks)38
Reflects downloads up to 14 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)An Analysis of Compiled Code Reusability in Dynamic CompilationProceedings of the 16th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3689490.3690406(43-53)Online publication date: 17-Oct-2024
  • (2023)Automatically Generated Supernodes for AST Interpreters Improve Virtual-Machine PerformanceProceedings of the 22nd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3624007.3624050(1-13)Online publication date: 22-Oct-2023
  • (2023)Reusing Just-in-Time Compiled CodeProceedings of the ACM on Programming Languages10.1145/36228397:OOPSLA2(1176-1197)Online publication date: 16-Oct-2023
  • (2023)Remote Just-in-Time Compilation for Dynamic LanguagesCompanion Proceedings of the 2023 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity10.1145/3618305.3623593(1-3)Online publication date: 22-Oct-2023
  • (2022)DSPBooster: Offloading Unmodified Mobile Applications to DSPs for Power-performance Optimal Execution2022 IEEE 46th Annual Computers, Software, and Applications Conference (COMPSAC)10.1109/COMPSAC54236.2022.00108(614-623)Online publication date: Jun-2022
  • (2022)Deoptfuscator: Defeating Advanced Control-Flow Obfuscation Using Android Runtime (ART)IEEE Access10.1109/ACCESS.2022.318137310(61426-61440)Online publication date: 2022
  • (2021)HHVM jump-startProceedings of the 2021 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO51591.2021.9370314(340-350)Online publication date: 27-Feb-2021
  • (2019)Reusable inline caching for JavaScript performanceProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314587(889-901)Online publication date: 8-Jun-2019

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media