Duby dynamic dispatch has landed!

Attila Szegedi szegedia at gmail.com
Thu Mar 25 01:16:26 PDT 2010


On 2010.03.25., at 3:17, Charles Oliver Nutter wrote:

> For Attila: I had to remove a spreadArguments handle you used for
> re-binding the method...not sure why. Here's the diff:
> 
> Index: src/org/dynalang/dynalink/support/DynamicLinkerImpl.java
> ===================================================================
> --- src/org/dynalang/dynalink/support/DynamicLinkerImpl.java	(revision 232)
> +++ src/org/dynalang/dynalink/support/DynamicLinkerImpl.java	(working copy)
> @@ -115,8 +115,6 @@
>         final MethodType genericType = invocation.type().generic();
>         final MethodHandle genericizedInvocation =
>             MethodHandles.convertArguments(invocation, genericType);
> -        final MethodHandle spreadInvocation = MethodHandles.spreadArguments(
> -                genericizedInvocation, SPREAD_GENERIC_INVOCATION);
> -        return MethodHandles.invoke(spreadInvocation, arguments);
> +        return MethodHandles.invoke(genericizedInvocation, arguments);
>     }
> }
> 
> I committed a built version with this hack...no tests, etc yet for
> Duby's "dynamic" type, but that will come soon.

That's odd. "arguments" is Object[]; spreadArguments is required to unpack these arguments and pass them on to the invoked method. 

The dynalang-invoke's own test suites fail quite massively when I make the change, and work without the change (well, sans a bunch of TestSimpleDynamicMethod#testVarArgs...() tests which fail due to a MLVM bug, but that's in unrelated code for vararg method handling). I do only have my last august's version of MLVM though; I might need to re-run the tests with a new MLVM, although, honestly, I'd be surprised if that changed anything since to me, the logic seems okay.

Attila.

--
home: http://www.szegedi.org
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com







More information about the mlvm-dev mailing list