My Language Feature Requests

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sun Dec 23 03:49:57 PST 2007


Christopher Wright wrote:
> While there is a fixed reference to the GC object, it is pinned. If that 
> reference is rebound to another GC object, the original object is 
> unpinned and the new one is pinned.
> 
> How to mark these is a difficult problem. On a 64-bit machine, I'd say 
> you just use the most significant bit as a flag; you're not going to use 
> petabytes of address space.

Since "fixedness" as proposed would be a compile-time property, and you 
already need metadata to find pointers to implement a moving GC, such a 
flag could be in that metadata instead of in the pointer itself. (The 
OffsetTypeInfo could say "there's a pointer at offset 8, of type Object, 
and it's fixed")
If run-time pinning is used instead (where whether the GC cell pointed 
to by a pointer is pinned is not known at compile time), it could be a 
simple (synchronized) counter that starts out at 0 for each memory cell, 
that's incremented when pinned and decremented when unpinned. The GC is 
then only allowed to move cells whose counter is 0.



More information about the Digitalmars-d mailing list