3 ms·
TruffleRuby and JRuby are two different projects. The history is a bit confusing. TruffleRuby was originally its own project internal to Oracle Labs. It was ope
by nirvdrum 9y ago
TruffleRuby and JRuby are two different projects. The history is a bit confusing. TruffleRuby was originally its own project internal to Oracle Labs. It was open-sourced and merged into JRuby as an alternative runtime, called JRuby+Truffle, and shipped with the JRuby 9K releases, activated by a special flag. As JRuby and JRuby+Truffle both kept evolving, it really became two separate projects within the same repository. So, at the end of 2016 we rolled JRuby+Truffle back out of JRuby into its own project, now called TruffleRuby.
Both JRuby & TruffleRuby are written in Java and target the JVM. JRuby now has its own IR for performing Ruby-level optimizations and it targets the JVM's invokedynamic system. TruffleRuby uses the Truffle self-optimizing AST framework [1] to implement its runtime and relies on integration with the Graal compiler to produce fast code via partial evaluation. Graal is a new compiler for the JVM written in Java. However, you need a JVMCI-enabled JVM to activate Graal. JVMCI is a new feature in Java 9, but we have a backport package available for Java 8 on the Oracle Technology Network (OTN) [3].
In addition, we ship a package with multiple Truffle languages and a Graal-enabled JVM in a package we call GraalVM. You can download that from OTN as well. That package also ships with a builder for the Substrate VM, which allows you to build an ahead-of-time compiled static binary of the various Truffle languages [4].
So, both JRuby and TruffleRuby target the JVM but they currently use different JITs. There's nothing stopping JRuby from using Graal, and indeed they've been looking at it, but they likely will continue using invokedynamic rather than Truffle.
Eclipse Ruby+OMR is a completely different project looking to take some VM components IBM has developed and integrate them with MRI. Since they're actually running MRI rather than a completely new project, they have 100% compatibility with Ruby, but they also have to operate within the confines of MRI's internal design.
[1] -- https://github.com/graalvm/graal/tree/master/truffle https://github.com/graalvm/graal/tree/master/truffle
[2] -- https://github.com/graalvm/graal/tree/master/compiler https://github.com/graalvm/graal/tree/master/compiler
[3] -- http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html http://www.oracle.com/technetwork/oracle-labs/program-langua...
[4] -- http://nirvdrum.com/2017/02/15/truffleruby-on-the-substrate-vm.html http://nirvdrum.com/2017/02/15/truffleruby-on-the-substrate-...
- misterbowfinger 9y agoCool! That was really informative, thank you!
- ksec 9y agoThx, does anyone know what is happening on the OMR front? Since it has been very quiet ever since it was first announced. Also wondering, for Truffle / GraalVM / SubstrateVM, how far are we from testing in production? I keep thinking TruffleRuby is Nightly / Beta and if i remember correctly, does not run Rails ( yet ) ?
- nirvdrum 9y ago> Thx, does anyone know what is happening on the OMR front? Since it has been very quiet ever since it was first announced. I don't know if there's a more official channel, but I follow Matthew Gaudet's tweets (@MattStudies). He provides periodic updates and provides links to talks and such. > Also wondering, for Truffle / GraalVM / SubstrateVM, how far are we from testing in production? I keep thinking TruffleRuby is Nightly / Beta and if i remember correctly, does not run Rails ( yet ) ? We're not at the point where we recommend anyone run it in production. We do actually run a sizable portion of Rails, but since the DB adapters are all C extensions we can't really run those yet, which practically means we can't run Rails. The distinction is we're able to run with things like the pure Ruby PostgreSQL gem (postgres-pr) and the pure Redis gem (redis). We're making some very good progress on our C extension support. We've just recently made a successful HTTPS request running MRI's OpenSSL extension by way of Sulong [1], which is an LLVM bitcode interpreter for Graal. If you're interested in casually following what we're up to, we now have a Twitter handle (@TruffleRuby). Or, you could always watch the GitHub project [2], since it is open source. [1] -- https://github.com/graalvm/sulong https://github.com/graalvm/sulong [2] -- https://github.com/graalvm/truffleruby https://github.com/graalvm/truffleruby