Inlining
Charles Oliver Nutter
headius at headius.com
Sun Aug 23 11:39:52 PDT 2009
On Wed, Aug 19, 2009 at 11:27 AM, Raffaello
Giulietti<raffaello.giulietti at gmail.com> wrote:
> invokedynamic's target is a handle that points to a method in a stub
> class. The method dispatches over the receiver's type. The dispatcher
> method invokes the ultimate method via a method handle kept in the stub.
> This scheme thus implements a simple inline caching solution.
It sounds like you're still dispatching through a generic piece of
code, yes? If you have a piece of code in the call path that all calls
pass through, you essentially defeat inlining entirely. JRuby runs
like this in normal mode on Java 6 and lower, and it defeats inlining
pretty handily. A better design, which can be turned on in JRuby, is
to pull the target method "object" all the way back to the place it's
being called, and invoke it there. Then it can be inlined.
You also need some serious caching in place to avoid re-looking-up the
method repeatedly. Do you have anything like that?
> A test program iterates a few million times, invoking the same method on
> the same instance, so the method handle kept in the stub is looked up
> via the slow path only once.
What does that method handle point at? What does the target method do?
- Charlie
More information about the mlvm-dev
mailing list