A sudden concern about invokedynamic
John.Rose at Sun.COM
Mon Jun 23 12:40:46 PDT 2008
On Jun 21, 2008, at 12:31 AM, Charles Oliver Nutter wrote:
> How would invokedynamic work if we don't have compiled Java bytecode
> anywhere to dispatch to? For example, JRuby is mixed mode right
> now, and
> some methods are interpreted (AST or various bytecode specs) while
> methods get compiled to JVM bytecode on-the-fly. For the compiled
> invokedynamic would just get a normal method handle. What about for
> interpreted ones? Essentially we want to be able to pass out a method
> handle that's actually just a call into the JRuby interpreter.
You probably want to use MethodHandles.insertArgument to introduce a
hidden receiver argument, which represents the target method as known
to the interpreter. You probably also want to use
MethodHandles.collectArguments to regularize the calling sequence
which the interpreted method gets.
> I don't recall seeing anything in the docs that might show how to do
> that. Did I miss something?
All those sorts of calling sequence adjustments must be composable
from method handle adapters, created by the MethodHandles methods
mentioned in the EDR spec. The real question is, did the EDR miss
More information about the mlvm-dev