Optimizing Java with Graal/Truffle

Matthias Grimmer Matthias.Grimmer at jku.at
Wed Oct 19 09:51:03 UTC 2016


Hi Alex,

Thanks for your interest in Truffle and Graal!

1) Graal is a dynamic compiler written in Java that integrates with the HotSpot JVM via JVMCI (Java Virtual Machine Compiler Interface).
Graal can then be used as an alternative to the client or server compiler.

However, Graal is also used by Truffle:
Truffle is a framework for implementing languages as simple AST interpreters.
Truffle uses the Graal compiler to automatically just-in-time compile the ASTs of your language implementation.

2) That is not a crazy idea at all. 
We had the same idea a few month back. At Johannes Kepler University Linz a PhD student is investigating the feasibility and potential of such an implementation.
The project is fairly new and I cannot yet point you to any papers/source code/documentation. 

3 and 4) A Truffle language implementation would be perfect for that use case.
With Truffle it is easy to prototype new extensions of a language without having to hack a compiler.

5) Truffle [1] comes with a simple demo language implementation (com.oracle.truffle.sl) which is a good starting point.
If you want to read only one of many Truffle papers, I would recommend  [2]. It describes the Truffe idea.
Or, if you would like to listen to a demo on Youtube, I recommend [3].

- Matthias

[1] https://github.com/graalvm/truffle <https://github.com/graalvm/truffle>
[2] http://dl.acm.org/citation.cfm?id=2509581 <http://dl.acm.org/citation.cfm?id=2509581>
[3] https://www.youtube.com/watch?v=FJY96_6Y3a4 <https://www.youtube.com/watch?v=FJY96_6Y3a4>
> On 18 Oct 2016, at 16:13, Alex Krause <krause.alexm at gmail.com> wrote:
> 
> Hello everyone,
> 
> I want to get into Graal / Truffle Development and have a few questions
> before I get started.
> 
> My current plan is to:
> + optimize specific cases of non-imperative programming (functional,
> reactive...)
> + write a framework or if necessary extend a language with new
> non-imperative language features
> + if possible use Truffle
> + use Java as optimization target language
> 
> My questions are:
> 1. If Graal executes Java Code, does it use Truffle?
> 2. Is there any project that executes Java through Graal with Truffle? Is
> this a bad idea? Do you think I'm crazy :)?
> 3. Is modifying Graal itself a realistic goal for optimizing a specific
> self written Java framework?
> 4. What would you suggest if I want to extend a subset of Java and change
> Graal to emit optimized code for my extensions?
> 5. Any concerns, opinions and tips on how to get started?
> 
> Thank you for any feedback
> Alex



More information about the graal-dev mailing list