On Sun, Apr 3, 2011 at 11:48 AM, Robert Fischer <[email protected]> wrote:
> Now, there's no way that I am aware of to go from a MethodHandle to a
> java.lang.reflect.Method instance and an array of arguments, which
> would then enable me to inline it at runtime. There are good reasons I
> can imagine for not allowing that, starting first and foremost with
> argument adapters (and pretty much all the mutations in the
> MethodHandles class), which means that the MethodHandle has semantics
> different from passing the given arguments to the given method.
In JRuby, since we support Java 5 and 6, the objects passed around as
"handles" are our own construct ("DynamicMethod"). There's metadata
there to know if it needs a heap-based scope, if it needs a Frame, the
shape if its arguments, and what JVM bytecoded method it points at.
Given that information we should (and do, in dynopt mode) have enough
to either insert direct calls (skipping dynamic call logic) *or*
inline the target code directly into the current one at runtime.
Using only MethodHandle would be lovely, but as you point out you may
need other metadata if you're going to do any magic at runtime.
Is Ashlar mixed-mode or compiled only?
> Of course, I'd really like to declare it's the JVM's problem and look
> forward longingly to the day when it's resolved there.
Indeed :) Of course right now we're just waiting for invokedynamic and
method handles to be fast fast fast, so it will be some time before
the JVM guys can come up for air and start considering new problems
like closure inlining.
- Charlie
--
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en.