Question about garbage collection specification
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 15 10:37:46 PDT 2015
On 6/15/15 12:37 PM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>"
wrote:
> On Monday, 15 June 2015 at 16:16:28 UTC, Steven Schveighoffer wrote:
>> How can the compiler POSSIBLY know whether a pointer points at GC data
>> in order to make it undefined behavior?
>
> It doesn't need to, the undefined behaviour comes from the unfulfilled
> expectations of the GC. For example, a "sufficiently advanced GC" with
> enough knowledge of types, including of local vars, could by chance run
> just at the moment when the only instance of the address is stored in an
> int variable, and disregard that variable because it's not a pointer. It
> is of course unlikely that GCs will ever get as much knowledge about
> local variables, or even unnamed temporaries...
That is clearly not the case in the documentation. 'p' maintains a
pointer to the data the entire time, before and after it's augmented.
I'm perfectly OK changing the documentation to say "do not use integral
types as the sole pointer to GC data." I can see how that may cause
issues with the GC that has more advanced type information.
> But I think you are right that the current restrictions are too strong.
> After some thoughts, I can't really see any realistic problem with
> tagged pointers.
Thanks for the consideration.
-Steve
More information about the Digitalmars-d
mailing list