hg: valhalla/valhalla/langtools: Add experimental support for generic class literals

Brian Goetz brian.goetz at oracle.com
Mon Aug 18 15:25:42 UTC 2014


The code-sharing possibilities between a byte version and an int version 
of List are obvious; there are tradeoffs to be made between code 
footprint and data footprint that have no obvious one-size-fits-all 
answer.

It gets nastier when you start to consider arbitrary value types, 
because values can hold references and references are special.  So the 
obvious approach of specializing one set of native code for 64-bit 
values, another for 96-bit values, etc, runs the risk of leaking 
references as ordinary bits.  One use a code-sharing model that treats 
all the non-reference bits in one bucket and all the reference bits in 
another, like "n longs and m references", but this starts to get 
complicated.



On 8/18/2014 11:02 AM, Maurizio Cimadamore wrote:
>
> On 18/08/14 15:48, Remi Forax wrote:
>> So the real number of variation is not clear yet (at least for me) but
>> each time you use 'any', you request for more specializations.
> Well, as soon as you start considering value types, the number of
> specialized classes is virtually unbound, regadless of what we do for
> byte/char/short, as we need a specialized Box<T> for each value class T.
>
> Maurizio


More information about the valhalla-dev mailing list