Re: @pinned classes

2010-04-02 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rainer Deyke wrote: > On 4/1/2010 15:22, div0 wrote: >> You can't easily or reasonably find the bits of the stack used by D >> code, so you can't scan the stack, and therefore you can't move any object. > > You could, if D was modified to register the

Re: @pinned classes

2010-04-02 Thread Rainer Deyke
On 4/1/2010 15:22, div0 wrote: > You can't easily or reasonably find the bits of the stack used by D > code, so you can't scan the stack, and therefore you can't move any object. You could, if D was modified to register the parts of the stack that it uses in some sort of per-thread stack registry.

Re: @pinned classes

2010-04-01 Thread Justin Spahr-Summers
On Thu, 01 Apr 2010 18:58:47 +0100, div0 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- > > a

Re: @pinned classes

2010-04-01 Thread bearophile
div0: > You can't easily or reasonably find the bits of the stack used by D > code, so you can't scan the stack, and therefore you can't move any object. > > Throw threading into the mix and your stacks get even more complicated. Thank you for your explanation, I have to learn more. In two years

Re: @pinned classes

2010-04-01 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 bearophile wrote: > div0: >> 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 >> dif

Re: @pinned classes

2010-04-01 Thread bearophile
div0: > 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 > la

Re: @pinned classes

2010-04-01 Thread div0
-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 > arithme

Re: @pinned classes

2010-04-01 Thread bearophile
Justin Spahr-Summers: > But shouldn't the GC know the size of Foo instances? Yes, if Foo is a class instance. >It seems like it should be able to rewrite any GC-managed pointers that point >to 'f' or anywhere inside it.< Maybe it can be done, but in a system language it can become a mess, bet

Re: @pinned classes

2010-04-01 Thread Justin Johansson
pinned classes can't contain pointers to their fields or to unpinned > memory, in a transitive way. They can contain pointers to pinned memory. > > In system (unsafe) modules you can of course cast a unpinned class referent > to a pointer, but this is nearly, because the GC can

Re: @pinned classes

2010-04-01 Thread Justin Spahr-Summers
On Thu, 01 Apr 2010 05:27:55 -0400, bearophile wrote: > > Justin Spahr-Summers: > > 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

Re: @pinned classes

2010-04-01 Thread bearophile
Justin Spahr-Summers: > 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 w

Re: @pinned classes

2010-03-31 Thread Justin Spahr-Summers
ystem (unsafe) modules you can of course cast a unpinned class referent > to a pointer, but this is nearly, because the GC can move the class in memory > in any moment. It can be useful for a short time if you disable the GC. > > Pinned classes act as now, they can contain pointers t

@pinned classes

2010-03-31 Thread bearophile
s or to unpinned memory, in a transitive way. They can contain pointers to pinned memory. In system (unsafe) modules you can of course cast a unpinned class referent to a pointer, but this is nearly, because the GC can move the class in memory in any moment. It can be useful for a short time if you d