blog post on invokedynamic

Tobias Ivarsson thobes at gmail.com
Tue Feb 17 02:41:55 PST 2009


On Tue, Feb 17, 2009 at 11:20 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
>
>
>
> Create a MOP is you have MethodHandles is more easier than without :)
> But how to handle the case where you want to call a ruby method with
> a PHP object.


This is what Interface Injection aims to solve.

When the JRuby runtime recevies an object from PHP it casts it to
IRubyObject (the main JRuby type) which is an injectable interface. If the
class of the object does not already implement IRubyObject the injector for
the interface is invoked. The injector is a regular java object that has a
method for providing MethodHandles that make up the implementation methods
for the interface. As in the case with the bootstrap method in invokedynamic
this method can do whatever the language implementor chooses to get or
define these MethodHandles. My recommendation in this case is for the
injector to get the meta object from the PHP object and use that to lookup
the MethodHandles for each capability that JRuby uses, and use default
implementations where the meta object does not support the capability.

I intend to contribute work on this to the dynalang project when the work on
interface injection is done, and the rest of my work queue is empty enough.
Hopefully in April, after PyCon.

Cheers,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20090217/a0f43729/attachment.html 


More information about the mlvm-dev mailing list