Christian Wimmer

Snippets: Taking the High Road to a Low Level

Doug Simon, Christian Wimmer, Bernhard Urban, Gilles Duboscq, Lukas Stadler, Thomas Würthinger: Snippets: Taking the High Road to a Low Level. In ACM Transactions on Architecture and Code Optimization, volume 12, issue 2, article 20. ACM Press, 2015. doi:10.1145/2764907

Download as PDF
© ACM, 2015.


When building a compiler for a high-level language, certain intrinsic features of the language must be expressed in terms of the resulting low-level operations. Complex features are often expressed by explicitly weaving together bits of low-level IR, a process that is tedious, error-prone, difficult to read, difficult to reason about, and machine-dependent. In the Graal compiler for Java we take a different approach: we use snippets of Java code to express semantics in a high-level, architecture-independent way. Two important restrictions make snippets feasible in practice: they are compiler specific, and they are explicitly prepared and specialized. Snippets make Graal simpler and more portable, while still capable of generating machine code that can compete with other compilers of the Java HotSpot VM.