Self-optimizing AST interpreters
Thomas Würthinger, Andreas Wöß, Lukas Stadler et al. · Symposium on Dynamic Languages (DLS) · 2012
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.
Cited by 134 works. doi:10.1145/2384577.2384587
Authors
References
- Java Virtual Machine Specification
- Threaded code
- An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes
- Tracing the meta-level
- Optimizing dynamically-typed object-oriented languages with polymorphic inline caches
- Debugging optimized code with dynamic deoptimization
- Trace-based just-in-time type specialization for dynamic languages
- Proceedings of the European Conference on Object-Oriented Programming
- Optimizing an ANSI C interpreter with superoperators
- The eval that men do: A large-scale study of the use of eval in javascript applications