skip to main content
10.1145/3617651.3622979acmconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

CacheIR: The Benefits of a Structured Representation for Inline Caches

Published: 19 October 2023 Publication History

Abstract

Inline Caching is an important technique used to accelerate operations in dynamically typed language implementations by creating fast paths based on observed program behaviour. Most software stacks that support inline caching use low-level, often ad-hoc, Inline-Cache (ICs) data structures for code generation. This work presents CacheIR, a design for inline caching built entirely around an intermediate representation (IR) which: (i) simplifies the development of ICs by raising the abstraction level; and (ii) enables reusing compiled native code through IR matching techniques. Moreover, this work describes WarpBuilder, a novel design for a Just-In-Time (JIT) compiler front-end that directly generates type-specialized code by lowering the CacheIR contained in ICs; and Trial Inlining, an extension to the inline-caching system that allows for context-sensitive inlining of context-sensitive ICs. The combination of CacheIR and WarpBuilder have been powerful performance tools for the SpiderMonkey team, and have been key in providing improved performance with less security risk.

References

[1]
1996. SpiderMonkey JavaScript Engine. https://spidermonkey.dev/
[2]
2008. V8 JavaScript Engine. https://v8.dev/
[3]
2020. Speculation in JavaScriptCore. https://webkit.org/blog/10308/speculation-in-javascriptcore/
[4]
2023. AreWeSlimYet. https://firefox-source-docs.mozilla.org/performance/memory/awsy.html
[5]
Wonsun Ahn, Jiho Choi, Thomas Shull, María J. Garzarán, and Josep Torrellas. 2014. Improving JavaScript Performance by Deconstructing the Type System. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’14). Association for Computing Machinery, New York, NY, USA. 496–507. isbn:9781450327848 https://doi.org/10.1145/2594291.2594332
[6]
Carl Friedrich Bolz, Antonio Cuni, Maciej Fijał kowski, Michael Leuschel, Samuele Pedroni, and Armin Rigo. 2011. Runtime Feedback in a Meta-Tracing JIT for Efficient Dynamic Languages. In Proceedings of the 6th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS ’11). Association for Computing Machinery, New York, NY, USA. Article 9, 8 pages. isbn:9781450308946 https://doi.org/10.1145/2069172.2069181
[7]
Preston Briggs, Keith D. Cooper, and L. Taylor Simpson. 1997. Value Numbering. Software: Practice and Experience, 27, 6 (1997), 701–724. https://doi.org/10.1002/(SICI)1097-024X(199706)27:6<701::AID-SPE104>3.0.CO;2-0
[8]
Stefan Brunthaler. 2010. Inline Caching Meets Quickening. In ECOOP 2010 – Object-Oriented Programming, Theo D’Hondt (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 429–451. isbn:978-3-642-14107-2
[9]
David Callahan, Steve Carr, and Ken Kennedy. 1990. Improving Register Allocation for Subscripted Variables. SIGPLAN Not., 25, 6 (1990), jun, 53–65. issn:0362-1340 https://doi.org/10.1145/93548.93553
[10]
C. Chambers, D. Ungar, and E. Lee. 1989. An Efficient Implementation of SELF a Dynamically-Typed Object-Oriented Language Based on Prototypes. In Conference Proceedings on Object-Oriented Programming Systems, Languages and Applications (OOPSLA ’89). Association for Computing Machinery, New York, NY, USA. 49–70. isbn:0897913337 https://doi.org/10.1145/74877.74884
[11]
Jiho Choi, Thomas Shull, and Josep Torrellas. 2019. Reusable Inline Caching for JavaScript Performance. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2019). Association for Computing Machinery, New York, NY, USA. 889–901. isbn:9781450367127 https://doi.org/10.1145/3314221.3314587
[12]
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 (POPL ’84). Association for Computing Machinery, New York, NY, USA. 297–302. isbn:0897911253 https://doi.org/10.1145/800017.800542
[13]
Andreas Gal, Brendan Eich, Mike Shaver, David Anderson, David Mandelin, Mohammad R. Haghighat, Blake Kaplan, Graydon Hoare, Boris Zbarsky, Jason Orendorff, Jesse Ruderman, Edwin W. Smith, Rick Reitmaier, Michael Bebenita, Mason Chang, and Michael Franz. 2009. Trace-Based Just-in-Time Type Specialization for Dynamic Languages. SIGPLAN Not., 44, 6 (2009), jun, 465–478. issn:0362-1340 https://doi.org/10.1145/1543135.1542528
[14]
Neal Glew, Spyridon Triantafyllis, Michal Cierniak, Marsha Eng, Brian Lewis, and James Stichnoth. 2004. LIL: An Architecture-Neutral Language for Virtual-Machine Stubs. 111–125.
[15]
Brian Hackett and Shu-yu Guo. 2012. Fast and Precise Hybrid Type Inference for JavaScript. SIGPLAN Not., 47, 6 (2012), jun, 239–250. issn:0362-1340 https://doi.org/10.1145/2345156.2254094
[16]
Urs Hölzle, Craig Chambers, and David Ungar. 1991. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP ’91). Springer-Verlag, Berlin, Heidelberg.
[17]
Urs Hölzle and David Ungar. 1994. Optimizing Dynamically-Dispatched Calls with Run-Time Type Feedback. SIGPLAN Not., 29, 6 (1994), jun, 326–336. issn:0362-1340 https://doi.org/10.1145/773473.178478
[18]
Steven S. Muchnick. 1997. Advanced Compiler Design and Implementation. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA. isbn:1558603204
[19]
Michael Smith, Abhishek Sharma, John Renner, David Thien, Sorin Lerner, Fraser Brown, Hovav Shacham, and Deian Stefan. 2023. Cachet: A Domain-Specific Language for Trustworthy Just-In-Time Compilers. In Workshop on Principles of Secure Compilation.
[20]
Thomas Würthinger, Christian Wimmer, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Christian Humer, Gregor Richards, Doug Simon, and Mario Wolczko. 2013. one vm to rule them all. In Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward! 2013). Association for Computing Machinery, New York, NY, USA. 187–204. isbn:9781450324724 https://doi.org/10.1145/2509578.2509581

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
MPLR 2023: Proceedings of the 20th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes
October 2023
184 pages
ISBN:9798400703805
DOI:10.1145/3617651
  • General Chair:
  • Rodrigo Bruno,
  • Program Chair:
  • Eliot Moss
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 October 2023

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. dynamically-typed programming languages
  2. inline caching
  3. just-in-time compilation

Qualifiers

  • Research-article

Conference

MPLR '23
Sponsor:

Upcoming Conference

ISSTA '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 242
    Total Downloads
  • Downloads (Last 12 months)61
  • Downloads (Last 6 weeks)1
Reflects downloads up to 16 Feb 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media