skip to main content
10.1145/2384577.2384587acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Self-optimizing AST interpreters

Published: 22 October 2012 Publication History

Abstract

An abstract syntax tree (AST) interpreter is a simple and natural way to implement a programming language. However, it is also considered the slowest approach because of the high overhead of virtual method dispatch. Language implementers therefore define bytecodes to speed up interpretation, at the cost of introducing inflexible and hard to maintain bytecode formats. We present a novel approach to implementing AST interpreters in which the AST is modified during interpretation to incorporate type feedback. This tree rewriting is a general and powerful mechanism to optimize many constructs common in dynamic programming languages. Our system is implemented in Java and uses the static typing and primitive data types of Java elegantly to avoid the cost of boxed representations of primitive values in dynamic programming languages.

References

[1]
J. R. Bell. Threaded code. Communications ACM, 16 (6): 370--372, 1973.
[2]
wski, and Rigo}Bolz09C. F. Bolz, A. Cuni, M. Fijałkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In Proceedings of the Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 18--25. ACM Press, 2009. 10.1145/1565824.1565827.
[3]
C. F. Bolz, A. Cuni, M. Fijałkowski, M. Leuschel, S. Pedroni, and A. Rigo. Runtime feedback in a meta-tracing JIT for efficient dynamic languages. In Proceedings of the Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 9:1--9:8. ACM Press, 2011. 10.1145/2069172.2069181.
[4]
}Brunthaler10aS. Brunthaler. Efficient interpretation using quickening. In Proceedings of the Dynamic Languages Symposium, pages 1--14. ACM Press, 2010. 10.1145/1869631.1869633.
[5]
}Brunthaler10bS. Brunthaler. Inline caching meets quickening. In Proceedings of the European Conference on Object-Oriented Programming, pages 429--451. Springer-Verlag, 2010. 10.1007/978--3--642--14107--2_21.
[6]
C. Chambers, D. Ungar, and E. Lee. An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 49--70. ACM Press, 1989. 10.1145/74877.74884.
[7]
C. Click. Fixing the inlining problem, 2011. URL http://www.azulsystems.com/blog/cliff/2011-04-04-fixing-the-inlining-pr%oblem.
[8]
ECMA. Standard ECMA-335: Common language infrastructure (CLI), 2012. URL http://www.ecma-international.org/publications/standards/Ecma-335.htm.
[9]
M. A. Ertl and D. Gregg. The structure and performance of efficient interpreters. Journal of Instruction-Level Parallelism, 5, 2003.
[10]
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 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 465--478. ACM Press, 2009.
[11]
Google. V8 JavaScript engine, 2012. URL http://code.google.com/p/v8/.
[12]
Google. V8 benchmark suite, 2012. URL http://v8.googlecode.com/svn/data/benchmarks/current/run.html.
[13]
B. Hackett and S. Guo. Fast and precise hybrid type inference for JavaScript. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 239--250. ACM Press, 2012. 10.1145/2254064.2254094.
[14]
C. Haubl, C. Wimmer, and H. Mössenböck. Evaluation of trace inlining heuristics for Java. In Proceedings of the ACM Symposium on Applied Computing, pages 1871--1876. ACM Press, 2012. 10.1145/2245276.2232084.
[15]
U. Hölzle, C. Chambers, and D. Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proceedings of the European Conference on Object-Oriented Programming, pages 21--38. Springer-Verlag, 1991.
[16]
U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 32--43. ACM Press, 1992. 10.1145/143095.143114.
[17]
T. Lindholm, F. Yellin, G. Bracha, and A. Buckley. The Java Virtual Machine Specification, Java SE 7 Edition, 2012. URL http://docs.oracle.com/javase/specs/jvms/se7/jvms7.pdf.
[18]
Mozilla. Rhino JavaScript VM, 2012. URL http://www.mozilla.org/rhino/.
[19]
T. A. Proebsting. Optimizing an ANSI C interpreter with superoperators. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages, pages 322--332. ACM Press, 1995. 10.1145/199448.199526.
[20]
G. Richards, C. Hammer, B. Burg, and J. Vitek. The eval that men do: A large-scale study of the use of eval in JavaScript applications. In Proceedings of the European Conference on Object-Oriented Programming, pages 52--78. Springer-Verlag, 2011. 10.1007/978--3--642--22655--7_4.
[21]
A. Rigo and S. Pedroni. PyPy's approach to virtual machine construction. In Companion to the ACM SIGPLAN Conference on Object Oriented Programming Systems, Languages, and Applications, pages 944--953. ACM Press, 2006. 10.1145/1176617.1176753.
[22]
Y. Shi, K. Casey, M. A. Ertl, and D. Gregg. Virtual machine showdown: Stack versus registers. ACM Transactions on Architecture and Code Optimization, 4 (4): 2:1--2:36, Jan. 2008. 10.1145/1328195.1328197.
[23]
K. Williams, J. McCandless, and D. Gregg. Dynamic interpretation for dynamic scripting languages. In Proceedings of the International Symposium on Code Generation and Optimization, pages 278--287. ACM Press, 2010. 10.1145/1772954.1772993.

Cited By

View all
  • (2024)Reducing Feedback PollutionProceedings of the 16th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3689490.3690404(65-74)Online publication date: 17-Oct-2024
  • (2024)Software Architecture Reconstruction for Microservice Systems Using Static Analysis via GraalVM Native Image2024 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER60148.2024.00008(12-22)Online publication date: 12-Mar-2024
  • (2024)BIFROST: A Future Graph Database Runtime2024 IEEE 40th International Conference on Data Engineering (ICDE)10.1109/ICDE60146.2024.00448(5605-5613)Online publication date: 13-May-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
DLS '12: Proceedings of the 8th symposium on Dynamic languages
October 2012
128 pages
ISBN:9781450315647
DOI:10.1145/2384577
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 48, Issue 2
    DLS '12
    February 2013
    114 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2480360
    Issue’s Table of Contents
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 ACM 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: 22 October 2012

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. dynamic languages
  2. java
  3. javascript
  4. language implementation
  5. optimization
  6. virtual machine

Qualifiers

  • Research-article

Conference

SPLASH '12
Sponsor:

Acceptance Rates

Overall Acceptance Rate 32 of 77 submissions, 42%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)113
  • Downloads (Last 6 weeks)9
Reflects downloads up to 23 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Reducing Feedback PollutionProceedings of the 16th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3689490.3690404(65-74)Online publication date: 17-Oct-2024
  • (2024)Software Architecture Reconstruction for Microservice Systems Using Static Analysis via GraalVM Native Image2024 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER60148.2024.00008(12-22)Online publication date: 12-Mar-2024
  • (2024)BIFROST: A Future Graph Database Runtime2024 IEEE 40th International Conference on Data Engineering (ICDE)10.1109/ICDE60146.2024.00448(5605-5613)Online publication date: 13-May-2024
  • (2023)TASTyTruffle: Just-in-Time Specialization of Parametric PolymorphismProceedings of the ACM on Programming Languages10.1145/36228537:OOPSLA2(1561-1588)Online publication date: 16-Oct-2023
  • (2023)AST vs. Bytecode: Interpreters in the Age of Meta-CompilationProceedings of the ACM on Programming Languages10.1145/36228087:OOPSLA2(318-346)Online publication date: 16-Oct-2023
  • (2023)Evaluating YJIT’s Performance in a Production Context: A Pragmatic ApproachProceedings of the 20th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3617651.3622982(20-33)Online publication date: 19-Oct-2023
  • (2023)Python meets JIT compilers: A simple implementation and a comparative evaluationSoftware: Practice and Experience10.1002/spe.326754:2(225-256)Online publication date: 5-Sep-2023
  • (2022)Who You Gonna Call: Analyzing the Run-Time Call-Site Behavior of Ruby ApplicationsProceedings of the 18th ACM SIGPLAN International Symposium on Dynamic Languages10.1145/3563834.3567538(15-28)Online publication date: 29-Nov-2022
  • (2022)Execution vs. Parse-Based Language Servers: Tradeoffs and Opportunities for Language-Agnostic Tooling for Dynamic LanguagesProceedings of the 18th ACM SIGPLAN International Symposium on Dynamic Languages10.1145/3563834.3567537(1-14)Online publication date: 29-Nov-2022
  • (2022)Automatically Transforming Arrays to Columnar Storage at Run Time✱Proceedings of the 19th International Conference on Managed Programming Languages and Runtimes10.1145/3546918.3560805(141-143)Online publication date: 14-Sep-2022
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media