News for hackers. Stuff that matters.
Re:Compilers for Free by nirvdrum on Thursday January 24, 2019 @11:50PM (#18995651)
If you're interested in looking into some active research in the area of partial evaluation, you should look at Truffle [1] and Graal [2] from my team at Oracle Labs. Graal is a new JIT compiler for HotSpot written in Java, with an API to interact with the compiler from Java. Truffle is a toolkit for implementing programming languages as self-optimizing AST interpreters. Truffle uses the Graal hooks to perform partial evaluation of Truffle-based interpreters to generate highly optimized native code.

The partial evaluator doesn't know anything about the language being compiled, save for a few annotations that Truffle provides to control inline caches and such. We're using this approach to create new optimizing runtimes for Ruby (TruffleRuby), JavaScript (Graal.js), R (FastR), Python (GraalPython), and even LLVM bitcode (Sulong). There are languages being implemented outside of Oracle Labs as well [3]. So, it's being stressed by a wide range of language semantics.

As for performance... I work mostly on TruffleRuby. There we're seeing considerable performance advantages against other Ruby implementations across a wide array of benchmarks and workloads. We really do get the JIT for free by virtue of being a Truffle-based language implementation. It's quite liberating as the compiler technology is free to evolve separately from our Ruby implementation, in contrast to the tight coupling you'd have with a language-specific JIT.

[1] -- https://github.com/oracle/graal/tree/master/truffle

[2] -- https://github.com/oracle/graal/tree/master/compiler

[3] -- https://github.com/oracle/graal/blob/master/truffle/docs/Lan...

Re:Compilers for Free by marktangotango on Friday January 25, 2019 @08:58AM (#18997861)
Isn’t “new” a bit of stretch? That project must be close to 10 years old by now!
Re:Compilers for Free by nirvdrum on Friday January 25, 2019 @09:10AM (#18997943)
Fair enough. You could date the project back to the Maxine days as well :-)

Joking aside, the Java-Level JVM Compiler Interface [1] was only added about a year ago, in Java 9. This is what allows using Graal with a stock JVM. So, for many people this is the point at which Graal became available.

[1] -- http://openjdk.java.net/jeps/243

Re:Compilers for Free by chrisseaton on Friday January 25, 2019 @09:04AM (#18997905)
Graal has a history going through Maxine, to HotSpot C1. It's been evolving for years, yes, but its application as a partial evaluator only goes back to 2012. TruffleRuby was started in 2013.