Skip to main navigation Skip to search Skip to main content

Automatically Generated Supernodes for AST Interpreters Improve Virtual-Machine Performance

Research output: Chapter in Book / Report / Conference proceedingConference contributionAcademicpeer-review

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 of 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.24x, an average steady-state speedup of 1.14x, and an average just-in-time compilation speedup of 1.33x on the web-tooling benchmark suite.
Original languageEnglish
Title of host publicationGPCE 2023
Subtitle of host publicationProceedings of the 22nd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
EditorsCoen De Roover, Bernhard Rumpe, Amir Shaikhha
PublisherAssociation for Computing Machinery, Inc
Pages1-13
Number of pages13
ISBN (Electronic)9798400704062
DOIs
Publication statusPublished - 2023
Externally publishedYes
Event22nd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences, GPCE 2023 - Cascais, Portugal
Duration: 22 Oct 202323 Oct 2023

Conference

Conference22nd ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences, GPCE 2023
Country/TerritoryPortugal
CityCascais
Period22/10/2323/10/23

Funding

This work has been supported by Oracle (ERO project 1332) and by the Swiss National Science Foundation (project 200020_188688). We thank the VM Research Group at Oracle Labs for their support. Oracle, Java, and HotSpot are trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

FundersFunder number
Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung200020_188688, 188688

    Fingerprint

    Dive into the research topics of 'Automatically Generated Supernodes for AST Interpreters Improve Virtual-Machine Performance'. Together they form a unique fingerprint.

    Cite this