JRuby invokedynamic updates for November

Charles Oliver Nutter headius at headius.com
Tue Nov 29 12:02:08 PST 2011


Hello friends!

Just updating you on the status of JRuby + invokedynamic, for those of
you following along.

About halfway through this month I did another pass at getting tests
passing with invokedynamic enabled, and finally turned on all uses (at
the time) of indy in JRuby! Hooray!

Last week, I finally enabled Ruby to Java dispatch via invokedynamic
for single-arity methods as well. The performance on those calls
appears to be about double what it was before...reflection is a harsh
mistress.

Last night, I added an experimental change to use invokedynamic for
looking up Ruby instance variables. Ruby ivars are basically like a
Map on every object, so we use various techniques to avoid storing an
entire map. My hope is that an indy lookup path will be faster than
the non-indy path...but so far, they're about equal. I have not
enabled this on master, but it can be enabled by passing
-Xinvokedynamic.cache.ivars=true to JRuby or
-Djruby.invokedynamic.cache.ivars=true passed to Java.

Invokedynamic is being used for the following:

* Method dispatches from Ruby to Ruby with fixed-arity target methods
that do not require heap frames
* Method dispatches from Ruby to Java with fixed-arity target methods
* Loads of literals and lazily-allocated runtime constructs
* Constant lookups
* Math and boolean operations where the right operand is a literal
integer or float have special treatment

Things are looking very good.

Also recently, I modified how JRuby prints out configuration
properties. All properties for invokedynamic should now be properly
displayed by passing --properties to JRuby.

Upcoming work includes getting Ruby methods with variable arity and
heap frames to use invokedynamic, as well as Java methods with
variable arity.

Have fun!

- Charlie


More information about the mlvm-dev mailing list