Fwd: Fwd: Proposal for generics over primitives needs a rethink

Gavin King gavin at hibernate.org
Mon Jan 5 20:01:14 UTC 2015


On Sat, Jan 3, 2015 at 5:10 PM, Remi Forax <forax at univ-mlv.fr> wrote:

> Why the engineering cost is very high ?
> Currently most of the Java VM implementations rely on the fact that
> you know upfront (without executing the code) if a field or a local variable
> is a reference or an object. In term of GC, there is a very clear
> distinction
> between the precise GC algorithms used in Java VM and the conservative
> GC algorithms used by example in C. Technically, with Any, you can
> implement something in the middle between these two categories of GC,
> nevertheless, it changes the category of GCs, Java will be able to use.

Remi the more I think about this objection the less sense it makes to me.

Currently, a field of type java.lang.Object may or may not reference
an instance (it might be null).

This is exactly the same as with an Any field: it may or may not
reference an instance, depending upon whether it is null or primitive.

So from the point of view of GC, precisely what is the difference? Any
seems to me the same as java.lang.Object for this purpose.

-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the valhalla-dev mailing list