| I'm the author of Ruby on Truffle. I'll talk you through exactly how we solve the problem of redefining Fixnum, as one example of how we've tackled these problems. Whenever you use Fixnum#+ in one of your methods, we lookup what that method is and cache the method so we can call it quickly next time. We actually never again check that this cache is still valid. The trick is that we sort of do the opposite - any time you do something that could invalidate that cache, we find the installed machine code that uses it, and delete it. If the machine code is still running somewhere on some stack for some thread or fibre, we jump from the machine code into an interpreted version which looks up the method again and carries on. So Kernel#eval makes no difference - if something that you eval ruins your later cached method calls in the same method, that's not a problem because if you're still running the same machine code, then you can't have redefined Fixnum#+. If you had redefined it, you'd be back in the interpreter getting ready to compile again with new caches. I'll also just point out that running RubySpec means we are successfully running something like 5000 lines of off-the-shelf unmodified systems code, just for the harness before we even get to the tests. Our theory is that we can make Ruby very fast, without having to forgo any of your favourite random dynamic monkey-patching features. Watch the video: http://medianetwork.oracle.com/video/player/2623645003001 Join us on the mailing list: http://mail.openjdk.java.net/mailman/listinfo/graal-dev |
Also, will it the very same Ruby we all know, compatible with everything? i.e. will it be the Christmas I envision?