Question on layer/peeling

Brian Goetz brian.goetz at oracle.com
Tue Jan 6 22:43:59 UTC 2015


I think Timo is just a little confused here.  (If it was a non-any-fied 
HashMap, we'd never specialize, you'd just get the today behavior, and 
the question is moot.)

On 1/6/2015 5:35 PM, Vitaly Davidovich wrote:
> I'm confused - are we talking about an any-fied hashmap or current
> hashmap? If the former, the null comparison will always be false and
> without having a default (T)/T.null/whatever, I'd expect a box operation
> to occur for the null check.
>
> Sent from my phone
>
> On Jan 6, 2015 5:32 PM, "Brian Goetz" <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
>     But bytecodes are supplemented by the BytecodeMapping attribute,
>     which reify the (static) instantiated type (as outlined in the SotS
>     writeup, and which you can see by running javap on a class compiled
>     with the valhalla compiler.)
>
>     On 1/6/2015 5:14 PM, Timo Kinnunen wrote:
>
>         The type in bytecode will be Object, but the type in source code
>         will be V, with V=boxed complex number, for example. The idiom
>         I’m thinking of is
>
>
>         Complex complex = numbers.get(nonexistentKey);
>
>         if(complex == null) return;
>
>         calculate(complex.re <http://complex.re>, complex.im
>         <http://complex.im>);
>
>
>
>
>
>
>         (Complex is a value type, numbers is a Java 5 hash map)
>
>


More information about the valhalla-dev mailing list