A new project initiated by IBM to create a toolkit for language runtimes is about to go open source, and it could be used to speed up the performance of existing runtimes for many languages.
The OMR project takes pieces of IBM's J9 Java virtual machine, decouples them from Java, and turns them into components that can be added to any other language runtime. What's more, proof-of-concept implementations for Ruby and Python are already in the works, with the Ruby variant set to be open-sourced shortly.
Pick up the pieces
According to a presentation given by Mark Stoodley, senior software developer at IBM Canada, at the 2015 JVM Language Summit, the reusable components include items that are often difficult to implement in any one language runtime -- for example, a JIT compiler that can provide a major boost to a language runtime's performance.
In his talk, Stoodley described IBM's rationale for the OMR project: to make it easier to maintain the J9 JVM across platforms. Maintaining any one language is difficult, he pointed out, especially when dealing with multiple hardware implementations (x86-64 vs. ARM vs. Power), and even a single hardware platform can be a moving target.
What's more, work done for any language runtime rarely aids work on another language runtime. And while ports of languages to the JVM often have their own active communities (such as Jython vs. Python), it comes at the cost of splintering the community across different implementations of the language.
IBM plans to take pieces of J9's VM and tun them into a set of open source resources that can be worked into other language runtimes. Aside from the JIT compiler, these components include a memory allocator, thread library, platform port library, event hook framework, VM and application-level trace engine, and garbage collector -- most of which are commonly found in any language interpreter, but have to be implemented separately for each language.
Since those functionsare implemented in J9 without any particular awareness of Java, in theory they can be reused for any language. The pieces provided by OMR could not only be added to existing runtimes, but could be used to build runtimes for entirely new languages as well.
Pedal to the metal
IBM has already selected two languages, Ruby and Python, as its first proofs-of-concept for this approach. Both have popular implementations -- the Ruby MRI and CPython -- that are widely used but often outperformed by the JVM and even other interpreters for the same language. The Ruby implementation will be open-sourced shortly, although there's no word yet on whether the Python project will follow suit.
Stoodley noted that OMR is not a research project, but a lingering interest for IBM's JDK product development team, since the project goes hand in hand with an aggressive refactoring of J9.
Many efforts to speed up existing languages typically revolve around creating a new runtime, such as HHVM for PHP or PyPy for Python. Done right, OMR could benefit not only these projects but the stock interpreters for those languages as well.
In the short run, it's more likely forks will show up that use OMR components, and will act as proving grounds for how OMR can be integrated back into core projects.