Tuesday, October 7, 2008

JRUBY

JRuby is a Java implementation of the Ruby interpreter, being developed by the JRuby team.

JRuby is free software released under a three-way CPL/GPL/LGPL license.

JRuby is tightly integrated with Java to allow the embedding of the interpreter into any Java application with full two-way access between the Java and the Ruby code. (Compare Jython for the Python language.)

JRuby's lead developers are Charles Nutter , Thomas Enebo, Ola Bini and Nick Sieger . In September 2006, Sun Microsystems hired Enebo and Nutter to work on JRuby full time. In June 2007, ThoughtWorks hired Ola Bini to work on Ruby and JRuby.

History
JRuby was originally created by Jan Arne Petersen, in 2001. At that time and for several years following, the code was a direct port of the Ruby 1.6 C code. With the release of Ruby 1.8.6, an effort began to update JRuby to 1.8.6 features and semantics. Since 2001, several contributors have assisted the project, leading to the current (2008) core team of four members.

The Netbeans Ruby Pack, available since NetBeans 6.0, allows IDE development with Ruby and JRuby, as well as Ruby on Rails for the two implementations of Ruby .

JRuby 1.1 added Just-in-time compilation and Ahead-of-time compilation modes to JRuby and is faster in most cases than the current Ruby 1.8.7 reference implementation.

JRuby 1.1.1 is stated to be packaged in Fedora 9.

Since version 1.1.1, the JRuby team began to issue point releases often to address quickly issues that may be brought up by users.


Rails
JRuby has supported Ruby on Rails since version 0.9 (May 2006) , with the ability to execute RubyGems and WEBrick. Since the hiring of the two lead developers by Sun, Rails compatibility and speed have improved greatly. JRuby version 1.0 successfully passed nearly all of Rails' own test cases. Since then, developers have begun to use JRuby for Rails applications in production environments .


Multiple Virtual Machine Collaboration
On February 27, 2008, Sun Microsystems and the University of Tokyo announced a joint-research project to implement a Virtual Machine capable of executing more than one Ruby or JRuby application on one interpreter.


Dynamic Invocation on Java Virtual Machines
JSR 292 (Supporting Dynamically Typed Languages on the JavaTM Platform) propose to:

add a new invokedynamic instruction at the JVM level, to allow method invocation relying on dynamic Type checking,
to be able to change the classes and method at runtime dynamically in a production environment.
The Sun Open source project Multi Language Virtual Machine aim to prototype this JSR. The first working prototype, developed as a patch on OpenJDK, was announced and made available on end of August 2008.

The JRuby team has successfully wired dynamic invocation in their codebase, albeit in a very primitive way. Dynamic invocation will ship with the next 1.1.5 release, and will be disabled on JVMs without Dynamic invocation capabilities.


Design
Since early 2006, the current JRuby core team has endeavored to move JRuby beyond being a simple C port, to support better performance and to aid eventual compilation to Java bytecode. To support this end, the team set an ambitious goal: to be able to run Ruby on Rails unmodified using JRuby. In the process of achieving this goal, the JRuby test suite expanded to such extent that the team gained confidence in the "correctness" of JRuby. As a result, toward the end of 2006 and in the beginning of 2007, they began to commit much more complicated redesigns and refactorings of JRuby's core subsystems.

JRuby is designed to work as a mixed-mode virtual machine for Ruby, where code can be either interpreted directly, just-in-time compiled at runtime to Java bytecode, or ahead-of-time compiled to Java bytecode before execution. Until October 2007, only the interpreted mode supported all Ruby's constructs, but a full AOT/JIT compiler is available since version 1.1[18]. The compiler design allows for interpreted and compiled code to run side-by-side, as well as decompilation to reoptimize and outputting generated bytecode as Java class files.

No comments: