Differences in asType between MLVM/bsdport and JDK7
Ola Bini
ola.bini at gmail.com
Fri May 27 01:21:41 PDT 2011
On 2011-05-27 13.40, John Rose wrote:
> On May 27, 2011, at 12:39 AM, Ola Bini wrote:
>
>>> Good. So what's the code that creates the target (not the
>>> fallback)? It looks like it has its types denatured to Object.
>>> -- John
>>
>> Actually, I was lying before - the code I inserted was not what
>> crashes. This is the code that crashes:
>
> Yes. Here's what's happening: Your _then (GWT target) is being
> accurately typed for the first time. This is good!
>
> I suggest adjusting the type of the GWT fallback to have the same
> type as _then, not denatured to Object*.
>
> That way, the execution of _then (your fast path, right?) will have
> the least "friction" due to type adjustments (checkcasts, etc.).
>
> Or, the other way to do it, is to use an invoker on type().generic().
> That should get you about what you were getting before.
>
> Note that the previous doc for "genericInvoker" was a little more
> vague but also promised exact types, not denatured Object* types:
> http://cr.openjdk.java.net/~jrose/pres/indy-javadoc-mlvm-old/2011-0510/java/lang/invoke/MethodHandles.html#genericInvoker(java.lang.invoke.MethodType)
>
> But I think a lot of people probably noticed that the denatured
> types came out of genericInvoker, and adjusted their code
> accordingly. (The name "generic" didn't help.) Such code will have
> to be adjusted again now that the behavior is corrected.
>
> -- John
I'm quite confused here. I've fixed my problem actually. My previous
code had:
MethodHandles.invoker(type())
that returned something that had type
(SephObject, Object, Object, Object)SephObject
I changed that line to be
findVirtual(MethodHandle.class, "invoke", type())
that returned something that had type
(SephObject, SThread, LexicalScope, MethodHandle)SephObject
which is correct.
I'm sure Remi said that those two things were supposed to do the same
thing. Now it seems invoker() is not as useful anymore.
Or am I completely misunderstanding things here?
Cheers
--
Ola Bini (http://olabini.com)
Ioke - JRuby - ThoughtWorks
"Yields falsehood when quined" yields falsehood when quined.
More information about the mlvm-dev
mailing list