Idea how to implement VT/VO compatibility in JVM

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jan 22 13:49:15 UTC 2015


On 22/01/15 13:47, Stéphane Épardaud wrote:
> On 01/22/2015 02:42 PM, Maurizio Cimadamore wrote:
>> That's mostly where I was trying to get at - bridges are a part of 
>> your approach - but it seems like some other part is missing in order 
>> to make the approach consistent.
>
> Well, sure, it requires _some_ support for `instanceof` and the 
> reflection API to handle this. But the reflection API will already 
> have to be tweaked for value types, so it's not like it's out of the 
> question.
And checkcast.

And arraystore (because of dynamic covariance checks).

...

Maurizio
>
>>> BTW, aren't you afraid of the proliferation of specialised classes 
>>> at runtime for the VM? I know PermGen moved away, but still, classes 
>>> are expensive to load…
>> As you might know, I did some work on reification in my early days 
>> [1] - among the things I found when implementing a JVM with support 
>> for reification was that in real-world cases, the number of different 
>> instantiation of the same generic class tends to be quite low. Of 
>> course this is another area where we need more evidence.
>
> I didn't know, but I would lean towards agreeing with you. At least in 
> the end usage where you will only have N sorts of `ArrayList<T>`, but 
> that multiplies because each is also a `List<T>` and an `Iterable<T>` 
> and a `Collection<T>` and will access `Stream<T>`… so even though you 
> will only instantiate N `T` values, you will get more classes than 
> just N.



More information about the valhalla-dev mailing list