atom feed3 messages in net.java.openjdk.mlvm-devJRuby success!
FromSent OnAttachments
Charles Oliver NutterMay 27, 2009 1:08 pm 
Martin C. MartinMay 27, 2009 2:46 pm 
Nicholas RileyMay 27, 2009 10:58 pm 
Subject:JRuby success!
From:Charles Oliver Nutter (char@sun.com)
Date:May 27, 2009 1:08:19 pm
List:net.java.openjdk.mlvm-dev

I have managed to get all the normal JRuby call paths wired up and was able to start up jirb (REPL) in force-compiled mode. This means that all normal calls are going through indy and working well enough to boot a fairly complicated app!

The changes have been pushed to the invokedynamic jruby branch on Kenai. At the moment there's a lot that can be improved, especially since there's a lot of extra logic in the target and fallback methods that would ideally be stitched together primitive method handles rather than having this generic shim right in the middle of the call path. But it should be at least as fast as the original call site logic and there's obviously a lot of room for improvement now.

The bulk of the code can be seen here:

http://kenai.com/projects/jruby/sources/main/content/src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java?rev=invokedynamic

The major additions are the try/catch/finally logic for non-local flow control and method_missing logic.

I think method_missing logic could be wired up as a second guard_with_test that checks visibility. So the fallback path would essentially stitch together logic to query for the method, check whether it's a method_missing scenario, and then call and cache either the method itself or method_missing.

The exception-handling logic I'm not sure about. This seems to be a possible gap in primitive method handles: an exception-handling method handle that can wrap another handle with additional logic. I'm not sure exactly how it would manifest itself in the API.

Anyway, things are looking pretty good. I will probably play with this a bit more to see if I can do a better decomposition of the call paths, but it should be usable right now.

- Charlie