Duby dynamic dispatch has landed!
Charles Oliver Nutter
headius at headius.com
Thu Mar 25 10:33:22 PDT 2010
On Thu, Mar 25, 2010 at 3:16 AM, Attila Szegedi <szegedia at gmail.com> wrote:
> 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.
FWIW, here's the error I was getting. I haven't dug into it much other
than to remove spreadArguments:
java.lang.ClassCastException: required class [Ljava.lang.Object; but
encountered class java.util.Collections$UnmodifiableRandomAccessList
from MethodHandle.java:357:in `invokeVarargs'
from MethodHandles.java:563:in `invoke'
from DynamicLinkerImpl.java:120:in `_relinkAndInvoke'
from FilterGeneric.java:520:in `invoke_C0'
from dynamic.duby:3:in `foo'
If you want to give it a shot you just need a JRuby snapshot build
(ci.jruby.org/snapshots), BiteScript (github.com/headius/bitescript),
and Duby (github.com/headius.duby). I committed my patched
dynalang-invoke jar in Duby's javalib dir. javac
src/org/jruby/duby/DynalangBootstrap.java and run jruby bin/duby <file
or -e> with appropriate JAVA_OPTS for invokedynamic.
Speaking of that...I was surprised there's no baseline bootstrap
method built into dynalang/invoke. It was a trivial amount of code to
write, but I can imagine a lot of simple uses of dynalang/invoke will
just want to use the standard multimethod Java dispatch directly. If I
put together a patch to include my DynalangBootstrap.java, will you
accept it? (or maybe I have commit rights and I don't know it?)
P.S. Switch to git :)
More information about the mlvm-dev