archives

Of Generics and Erasure and, of all things, GC and memory layout

I'm trying to grok the difference in generics implementation between Java and C++, specifically the implications of type erasure in Java.

Most of the info I'm finding is blogger stuff, so I'm wondering if there's any better-than-most analysis of the issue out there.

This issue also makes me wonder about the impact of having to store type info along with data - a required "vtable pointer" in C# lingo if I get that right - on some traditional memory layout schemes.

Does this put an end to BIBOP like value typing schemes, if many small words are type parameterized? Box[T], Pair[T,U] and so on???

Or how about the two word Cons cell tricks (via distinguished non-Cons object header word) vs. List[T] where one needs a vtable word in every Cons cell along with head/tail (car/cdr whatever), which with 2 word alignment is going to make for big fat 4 word cons cells?

Inquiring minds want to know :-)

Scott