Automatically Generated Supernodes for AST Interpreters Improve Virtual-machine Performance
Abstract syntax tree (AST) interpreters allow implementing programming languages in a straight-forward way. However, AST interpreters implemented in object-oriented languages, such as e.g. in Java, often suffer from two serious performance issues. First, these interpreters commonly implement AST nodes by leveraging class inheritance and polymorphism, leading to many polymorphic call sites in the interpreter implementation and hence lowering interpreter performance. Second, widely used implementations of these interpreters throw costly runtime exceptions to model the control flow. Even though Just-in-Time (JIT) compilation mitigates these issues, performance in the first stages of the program execution remains poor.
In this paper, we propose a novel technique to improve both interpreter performance and steady-state performance, lowering also the pressure on the JIT compiler. Our technique automatically generates AST supernodes ahead-of-time, i.e., we automatically generate compound AST-node classes that encode the behavior of several other primitive AST nodes before the execution of the application. Our technique extracts common control-flow structures from an arbitrary, given set of ASTs, such as e.g. the functions of popular packages. It is based on matchmaking of AST structures, instantiation of matching supernodes, and replacement the corresponding AST subtrees with the instantiated supernodes at load-time. We implement our technique in the GraalVM JavaScript engine, showing that our supernodes lead to an average interpreter speedup of $1.24\times$, an average steady-state speedup of $1.14\times$, and an average just-in-time compilation speedup of $1.33\times$ on the web-tooling benchmark suite.
Mon 23 OctDisplayed time zone: Lisbon change
16:00 - 17:30 | |||
16:00 30mTalk | Virtual Domain Specific Languages via Embedded Projectional Editing GPCE | ||
16:30 30mTalk | Unleashing the Power of Implicit Feedback in Software Product Lines: Benefits ahead GPCE Raul Medeiros University of the Basque Country (UPV/EHU), Oscar Diaz University of the Basque Country, Spain, David Benavides Universidad de Sevilla | ||
17:00 30mTalk | Automatically Generated Supernodes for AST Interpreters Improve Virtual-machine Performance GPCE Matteo Basso Università della Svizzera italiana (USI), Switzerland, Daniele Bonetta Oracle Labs, Walter Binder USI Lugano |