Automatic Generation of Truffle-based Interpreters for Domain-Specific Languages

By: Manuel Leduc, Gwendal Jouneaux, Thomas Degueule, Gurvan Le Guernic, Olivier Barais, Benoit Combemale


Numerous language workbenches have been proposed over the past decade to ease the definition of Domain-Specific Languages (DSLs). Language workbenches enable DSL designers to specify DSLs using high- level metalanguages, and to automatically generate their implementation (e.g., parsers, interpreters) and tool support (e.g., editors, debuggers). However, little attention has been given to the performance of the resulting interpreters. In many domains where performance is key (e.g., scientific and high-performance computing), this forces DSL designers to handcraft ad-hoc optimizations in interpreter implementations, or lose compatibility with tool support. In this paper, we propose to systematically exploit domain-specific information of DSL specifications to derive optimized Truffle-based language interpreters executed over the GraalVM. Those optimizations are provided at no extra cost for the DSL designer. They are of course not as efficient as handcrafted optimizations, but do not require extra time or knowledge from the DSL designer (which industrial DSL designers often lack). We implement our approach on top of the Eclipse Modeling Framework (EMF) by complementing its existing compilation chain with Truffle-specific information, which drives GraalVM to benefit from optimized just-in-time compilation. A key benefit of our approach is that it leverages existing DSL specifications and does not require additional information from DSL designers who remain oblivious of Truffle’s low-level intricacies and JIT optimizations in general while staying compatible with tool support. We evaluate our approach using a representative set of four DSLs and eight conforming programs. Compared to the standard interpreters generated by EMF running on GraalVM, we observe an average speed-up of x1.14, ranging from x1.07 to x1.26. Although the benefits vary slightly from one DSL or program to another, we conclude that our approach yields substantial performance gains while remaining non-intrusive of EMF abstractions.


domain-specific languages, meta-languages, interpreters, just- in-time optimization

Cite as:

Manuel Leduc, Gwendal Jouneaux, Thomas Degueule, Gurvan Le Guernic, Olivier Barais, Benoit Combemale, “Automatic Generation of Truffle-based Interpreters for Domain-Specific Languages”, Journal of Object Technology, Volume 19, no. 2 (July 2020), pp. 1:1-21, doi:10.5381/jot.2020.19.2.a1.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn

The JOT Journal   |   ISSN 1660-1769   |   DOI 10.5381/jot   |   AITO   |   Open Access   |    Contact