Sunday, September 10, 2006

XRuby project is now hosted on Google Code

XRuby is an open source Ruby compiler which compiles Ruby source code (.rb) to Java bytecode (.class). On last Friday I moved the source code from my local Subversion server to Google Code(code.google.com/p/xruby/), so the project is now public available (GPL license).

Although I have never announced this project, I have been working on it for more than one year. This February I made the parser public available, now the main effort is on the compiler backend (java bytecode generation). I expect to release the first stable version at the end of 2006.

So far I am not very satisfied with my progress. I have a busy day job which has nothing related to Ruby and Java, so can only manage to work on XRuby about one hour a day(except weekends and holidays). When I started the project I thought XRuby is going to be the first ruby compiler in the world. But now Gardens Point Ruby.NET has released their first alpha version, and I expect JRuby will start to do their compiler in a few months (since they have been hired by Sun to work on JRuby full time).

Anyway, the project gives me lots of fun and the implementation starts to gain momentum. It looks very promising to see the first stable release around this new year, stay tuned:)

3 Comments:

Anonymous Anonymous said...

Very exciting project! A few comments, hopefully they'll help...

1. Fixnum should be backed by long to match precision with Ruby.

2. You may find that a class-per-method is a little heavyweight. We played with a similar approach in the past, but the thousands of methods in Ruby severely increased the class load.

I'm curious how you'll handle evals...will you parse and compile every time?

We do actually have a partial compiler in the JRuby source right now that emits straight Java bytecode for perhaps 50% of AST nodes. In a few simple test cases, it has increased performance by 2 to 3 times. We want a greater boost than that, so we've put compiler work on hold to improve the speed of method invocation, a large bottleneck in current source.

Great job on XRuby! I'm sure there's a lot we can share and learn from each other!

- Charles Oliver Nutter, headius@headius.com, headius.blogspot.com
(blogger doesn't allow blogger beta accounts to post :(

1:16 PM  
Blogger xue.yong.zhi said...

Thank you for your comments, Charles! 1 & 2 are good points and I am aware of those problems as well -- just too many things at hands and too little time:(

As for eval, the compiler just compiles the code at runtime, as there is simply no way to do it at compile time. Still, passing locals to eval is quite painful.

btw, I am on jruby maillist and a subscriber of your blog. Congratulations on your new job at sun.

2:33 PM  
Anonymous Anonymous said...

Hi Yawl, (Sorry not a comment on xruby) I see seclib.com/seclib has gone. Did you take it down just because it hadn't been updated for a while? There were some interesting articles there. -- Tony ids@list.afraid.org.

3:17 AM  

Post a Comment

<< Home