RubyC

RubyC: Ruby Compilation

The RubyC project is part of the PHI: Programming with High-Level Languages and Interfaces group at Indiana University. The RubyC project is attempting to use compiler techniques in order to speed up the execution of Ruby programs. The current research is focused on source-to-source compilation and source-level optimization that can be applied with the specific aim of speeding Ruby on Rails application code. The goal is to apply the lessons learned to more general Ruby compilation problems, and to apply what we learn to other high-level dynamic languages (like JavaScript, Python, and Perl).

Progress

The current focus has been on applying source-level optimization techniques to source code for Ruby 1.8.x, since this is the version of Ruby that Rails is currently targeted on. Recently we have been working on getting concrete partial evaluation running in our compiler, using the Ruby interpreter to pre-compute values where possible, to avoid doing this at run-time.

You can read more about our progress by following Andy Keep’s Compiler Blog.

Tools

The current toolset includes using Stratego/XT along with the Ruby 1.8.x interpreter to perform program transformation and partial evaluation. The Ruby 1.8.x interpreter is used to parse Ruby code into ATerms which Stratego/XT can use, and we tie the two together using C, which integrates well with both tools.

Related Work

Implementations

There are many other implementations of Ruby moving forward to improve the speed of Ruby programs. Some of the notable implementations currently underway are:

  • Ruby 1.8.x: The Matz Ruby Interpreter (or MRI) the current “standard” implementation of Ruby by the language’s creator.
  • Ruby 1.9.x: The next version of Ruby, using the YARV virtual-machine to speed the execution of Ruby code
  • JRuby: An implementation of Ruby 1.8.x that runs on the JVM
  • XRuby: A Ruby to Java Byte-Code compiler
  • IronRuby: An implementation of Ruby 1.8.x that runs on the .NET CLR
  • Rubinius: A virtual-machine based loosely on the Smalltalk-80 implementation

Some younger implementations that are just starting to show up or are still under development:

  • HotRuby: An implementation of the YARV byte-code to run through JavaScript
  • MacRuby: An implementation of the YARV byte-code to run through Objective-C on a Mac
  • IronMonkey: An attempt to get IronPython and IronRuby running on the Tamarin VM
  • MagLev: Ruby running on top of extensions to the Smalltalk-based GemStone VM

(Let me know if I’m missing your favorite implementation here, I’m always happy to read about other implementations and I’ll like it up here.)

Academic Work  

  1. Koichi Sasada. YARV: Yet Another RubyVM: Innovating the Ruby Interpreter. In OOPSLA ‘05: Companion to the 20th annual ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, pages 158–159, New York, NY, USA, 2005. ACM.   

  2. Christopher C. Aycock. MPI Ruby with Remote Memory Access. In Proceedings of the 13th IEEE International Symposium on High Performance Distributed Computing (HPDC), pages 280-281, 2004.   

  3. Michael Furr, Jong-hoon (David) An, Jeffrey S. Foster, and Michael Hicks. Static Type Inference for Ruby. Draft, March 2008.   

 

People

Permalink Print