@pinned classes
Justin Spahr-Summers
Justin.SpahrSummers at gmail.com
Thu Apr 1 17:56:46 PDT 2010
On Thu, 01 Apr 2010 18:58:47 +0100, div0 <div0 at users.sourceforge.net>
wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Justin Spahr-Summers wrote:
> > On Wed, 31 Mar 2010 22:59:08 -0400, bearophile
> >>
> >> Bye,
> >> bearophile
> >
> > I think the D2 spec puts restrictions on what you can do with GC-
> > allocated pointers (can't convert them to integers, can't perform
> > arithmetic on them outside of their bounds, etc.), and I think they're
> > restrictive enough that a copying garbage collector could work with no
> > changes to compliant code.
> >
> > - Justin Spahr-Summers
>
> The trouble with a moving garbage collector is that you have to be able
> to accurately scan the stacks of all threads. This is difficult to do
> with a language that can arbitrarily call into functions provided by
> different languages for which the compiler won't and can't have stack
> layout info.
>
> It's especially a pain on windows, as D code is called from window
> procedures, so most code is already using a stack which can't be scanned.
>
> Might be more doable on linux, xlib has a vastly better design than win32.
>
> - --
> My enormous talent is exceeded only by my outrageous laziness.
> http://www.ssTk.co.uk
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFLtN7XT9LetA9XoXwRAsD9AJ49Ml2eW3JgW4RXL3qvJmqQZDpAVgCfUodR
> 2tAAm34SNHuoiRv82+4jPyQ=
> =CBev
> -----END PGP SIGNATURE-----
My knowledge of garbage collection techniques isn't as extensive as I'd
like it to be. My previous reply was mostly an assertion that the D spec
is strict enough about GC-managed pointers that more advanced/precise
garbage collectors SHOULD theoretically be possible, although there may
be platform-imposed obstacles like what you mentioned.
For instance, I think the standard is specific enough that maybe GC-
managed "pointers" could be implemented as indices into a managed-memory
lookup table, using an actual pointer when calling extern (C) functions
or some such. I really doubt this is an optimal implementation, but my
understanding is that it should be possible without any code changes to
compliant D programs.
More information about the Digitalmars-d
mailing list