Compressed class references?

Alex Rønne Petersen xtzgzorex at gmail.com
Sun Mar 11 17:44:21 PDT 2012


On 12-03-2012 01:41, bearophile wrote:
> A significant percentage of heap memory in a 64 bit JavaVM is used by references, that are 8 bytes long. To reduce this problem they have invented "compressed references" (useful only for 64 bit systems), that turn references to 32 bit again:
>
> https://blogs.oracle.com/jrockit/entry/understanding_compressed_refer
>
> ftp://public.dhe.ibm.com/software/webserver/appserv/was/WAS_V7_64-bit_performance.pdf
>
> With them the total amount of heap memory decreases. They don't slow down the class usage significantly, and the memory reduction reduces the CPU cache pressure, increasing the performance a bit.
>
> Will this idea be useful for 64 bit D/DMD too, for D GC-managed class references (not for raw pointers)?
>
> Bye,
> bearophile

This probably can't work for D.

The problem is that D allows casting references to pointers. As we all 
know, a pointer is a distinct type from a reference, and casting a 
pointer to e.g. an integer type is perfectly valid and sometimes 
necessary. So, that is to say, this would blow up when doing the 
reference -> pointer conversion.

You could do it such that when one does the ref -> ptr conversion, the 
reference is simply expanded to a normal pointer, and vice versa. 
However, I'm not sure if this will hold water in the long run.

-- 
- Alex


More information about the Digitalmars-d mailing list