Monday, March 03, 2008

JSR223 JRuby engine update

I fixed one more bug to make JRuby engine work on JRuby 1.1RC2 yesterday, so I updated CVS today. Now, the latest version in CVS repo is compliant to JRuby 1.1RC2.

I figured out that another bug was caused by newly added org.jruby.util.io.ChannelStream class to JRuby. ChannelStream has a sync member which is set to be false by default and flushes the output buffer only when the sync's value is true, or huge strings are set to output buffer. A ChannelStream type instance used in an ordinary eval process has the true value in its sync; however, it has false when it is used from the process starts from IRubyObject#callMethod(). I fixed this by forcibly setting true to the sync since I couldn't figure out when and by whom its value is changed into true in JRuby.

I encountered further bug when I ran examples on Mac OS X. This should be the bug of JDK 1.6 for Max OS X because it never happens on Ubuntu. When a big Ruby script is pared by the parseEval method, a part of script seems to be truncate because JRuby raises a syntax error though Ruby scripts are written in completely correct syntax. JRuby engine has a way of avoiding this bug which is to set a filename of the Ruby script to JRuby engine's context by using a "ScriptEngine.FILENAME" property.

My next work would be to write more examples and tests to know how perfect the engine works with current and future versions of JRuby.

No comments: