Duby dynamic dispatch has landed!
Charles Oliver Nutter
headius at headius.com
Thu Mar 25 12:32:37 PDT 2010
On Thu, Mar 25, 2010 at 1:14 PM, John Rose <John.Rose at sun.com> wrote:
>> MethodHandleImpl.java:1104:in `raiseException':
>> 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'
>> ...
>
> Do you know who is creating the UnmodifiableRandomAccessList?
>
> It looks like it needs a toArray call to create the low-level varargs list.
I don't think it does. The URAL comes from Duby's literal array syntax
(the [1,2,3] in the example) and for the error in question it's simply
the receiver of the call (getClass or size).
>> 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.
>
> I did some browsing and downloading, but there are too many moving parts to quickly figure out... Sorry!
We'll have a release of Duby soon...then it will simply be:
1. install JRuby somehow (unpack, run installer, whatever)
2. gem install duby
3. duby <blah>
I'll let this list know when it's available that way.
>> 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?)
>
> No, sorry, you don't at present, but you should have one. However, to my surprise, you are not on this list, which is the first place your name needs to appear for such things:
> https://sca.dev.java.net/CA_signatories.htm
>
> Send me link to DynalangBootstrap.java. I browsed a couple obvious places under github.com/headius/duby but didn't see it. (And there's no download page??)
Actually I think this could just go into Attila's project, unless the
baseline dynalang Java MOP stuff could get included in JSR-292 (which
would be awesome, but I know that's a huge addition and it's too
late). I just figured that people interested in "plain old Java
dynamic dispatch" would want to just specify an existing bootstrap
method in Attila's library that only does Java multi-method dispatch.
In my ideal world, JSR-292 would ship with a default bootstrapper that
just does Java dispatch (with appropriate conversions for JLS dispatch
and maybe a minimal PIC) so that adding a "dynamic" type to Java
itself would basically be a done deal. Then Attila's MOP stuff would
just fall back on that dispatcher after trying language-specific ones.
- Charlie
More information about the mlvm-dev
mailing list