Moving GC

Steven Schveighoffer schveiguy at
Sat Dec 13 16:06:38 PST 2008

"Sean Kelly" wrote
> == Quote from Christopher Wright (dhasenan at's article
>> This isn't unreasonable, and it really just depends on how complete and
>> how fast D's runtime reflection is.
> This would incur more memory overhead as well.  Right now, we make
> do with one bit per block that indicates whether the block should be
> scanned for pointers, while this may theoretically require a pointer
> to TypeInfo per block in order to perform precise scanning.

You need a bitfield indicating which ptr-sized blocks are valid pointers.

For example, a 16-byte block (on 32-bit system) only requires 4 bits.

For 16, 32, 64, 128 byte blocks, you can probably get away with just a 
bitfield per block.

For larger ones, you may have to have a pointer to a bitfield.  But the 
bitfield should also always contain a bit that says whether the block is an 
array.  That way, you only need one bitfield per element (i.e. the bit 
pattern repeats).

Perhaps, you have one bit that says whether the block is an array, one bit 
that says whether the 'bitfield' is really a pointer to a static bitfield 
(for larger elements).

These bitfields can easily be stored with the TypeInfo by the compiler.


More information about the Digitalmars-d mailing list