Since joining Sun, Charles Nutter
has been burning the midnight oil working on JRuby
. In his latest blog entry Charles provides is with an update on his progress.
Charles lists the following features as working.
- all three kinds of calls
- local variables
- string, fixnum, array literals
- 'def' for simple methods and arg lists
The biggest challenge he is now facing is with the last item in the list. He is currently working on how JRuby will to pass closures to methods.
JRuby is still heavily dependent on ThreadContext nonsense, there's no easy way to pass it to a given method. So the next step to getting closures to work in the compiler is to start passing them on the call path as a parameter, much like we do for ThreadContext
The surprising point is that Charles has been able to achieve the bytecode generation and node walking all in about 900 LOC. Though Charles maybe complaining that it is large and cumbersome it is difficult to see how anyone could create something this complex without having some ugliness appear in the first implementation. You can see in the posting that Charles is setting himself up to be able to refactor once things are working.
it's behind a fairly straightforward interface, so the node-walking code doesn't ever see the ugliness. I believe it will be much easier to maintain, and it's certainly easier to follow
The note ends and then begins again with some nice benchmarking numbers. Charles reports that he is happy that the numbers are getting better. In some cases JRuby out performs Ruby 1.8.5. You can see the entire set of numbers here