Differences in asType between MLVM/bsdport and JDK7

John Rose john.r.rose at oracle.com
Fri May 27 01:10:40 PDT 2011


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


More information about the mlvm-dev mailing list