Brussels / 30 & 31 January 2016

schedule

Sulong: Fast LLVM IR Execution on the JVM with Truffle and Graal


This talk gives a hands-on technical overview of Sulong, a LLVM IR interpreter written in Java on top of the Truffle framework which will be released under a BSD 3-Clause License within the next few weeks. Sulong uses Graal as a JIT compiler which performs aggressive optimizations to reach native execution speeds. We will shortly explain the concepts of Truffle and Graal, to then focus on Sulong itself.

First, we will present how to get started hacking Sulong, and use the mx build tool of the Truffle/Graal ecosystem. We use the Truffle Domain Specific Language (DSL) to implement LLVM IR operations as AST nodes, and we will demonstrate how Graal optimizes and compiles the AST. Subsequently, we demonstrate how we implement speculative optimizations such as value profiling, profile based inlining, branch probability injection, inlining of function pointer calls, and other dynamic optimizations.

We show how Sulong uses the Java Unsafe API to access native memory and implement pointers. By using the Graal Foreign Native Interface Sulong can call native libraries directly from Java code. Virtual registers from LLVM bitcode are mapped to the Truffle Frame implementation which gets escape-analyzed and thus ensures fast access to local variables. We show how we map some of the common data types such as I32 directly to Java primitives, and how we map others such as the X86 80 bit floating point to custom Java types.

Finally, we give you an outline of the things we still want to implement in Sulong, and how other Truffle languages can use Sulong as their native interfaces, and perform function inlining and optimizations over language boundaries. We will also present how we want to use Truffle and the Java platform to implement security features such as efficient integer overflow value tagging and memory safety.

Speakers

Manuel Rigger

Attachments

Links