JRuby Roundup: JRuby 1.3 Released, ruby2java, JSR 292 Progress
JRuby 1.3 is now available, and brings many performance improvements and bug fixes. New improvements are the inclusion of Nailgun, faster timeout and others(more detailed information of the changes in 1.3 such as Nailgun or dropped Java 1.4 support).
JRuby 1.3 is also the first stable release that works with Google AppEngine's Java support.
There seems to be an issue with the new version of
timeout). The issue is fixed in JRuby's trunk version. There are workarounds, such as building JRuby from trunk, but a 1.3.1 release with a fix might become available too.
Meanwhile, the work on improving JRuby's speed continues. One project to improve compiled JRuby is ruby2java:
The Ruby2Java compiler inspects the *runtime* definition of classes to produce a normal-looking Java class. All metaprogrammed methods are reflected on the Java class, as are runtime modifications to those methods.
The ruby2java project is hosted at Kenai. Ruby2java requires at least JRuby 1.3 to work.
Ruby2java aims to improve JRuby speed on currently existing JVMs. However, some new changes in the JDK/Java 7 might allow some more significant improvements in efficiency. JSR-292 collects the first few changes to the JVM to achieve this goal.
One change is the introduction of a new bytecode
invokedynamic, which allows to provide custom lookup methods for a call site, ie. if a message is sent to a receiver, the language runtime is invoked to handle the lookup and return the actual method to execute. While this might not bring major improvements in itself, the idea is that JVMs could provide better optimizations for these types of call sites.
This approach has been discussed for years, but it's slowly becoming real. Some talks at JavaOne'09 were dedicated to JSR-292: Towards a Renaissance VM (link to online version of slides) and JSR 292 Cookbook (link to online version of slides). The two talks discuss the changes in depth and also provide ideas for future changes to the JVM.
Charles Nutter also made progress in using using
invokedynamic and the new method handles in JRuby, an early version of the code is available in a JRuby branch.
The new features are only available on research versions of the JVM or early JDK 7 builds (
invokedynamic landed in the JDK 7 tree a few weeks ago).