New pointer type for GC

Bastiaan Veelo via Digitalmars-d digitalmars-d at puremagic.com
Wed May 28 10:36:05 PDT 2014


On Tuesday, 27 May 2014 at 16:47:38 UTC, Etienne wrote:
> You're right, it's obviously easier to keep it as the same 
> pointer syntax but hijack the stdlib malloc functions to 
> forcibly go through the GC.
>
> If the GC controls everything, you can keep the info in 8 byte 
> pointers.
>
> - The GC always returns an libc-incompatible pointer value
> - Dereferencing should call the resolver from the GC to process 
> it with the libc-compatible value (possibly just removing the 
> last couple bytes)
> - Sending a pointer through extern(C) should call the sanitizer 
> which resolves the real pointer through the GC and sends that
> - The last bytes of a pointer would contain thread ID for 
> void** and poolID for void*
> - This would only work on x64 platforms

This would also help implementing weak references, am I right? 
Which then come in handy when improving std.signals?

Bastiaan.


More information about the Digitalmars-d mailing list