On 19-10-2012 11:07, sclytrack wrote:
How does it deal with the problem where a pointer in TLS points to
global data,
Need to run stop-the-world for shared heap. But it would be interesting
to have blocks that have no shared pointers in them.
The problem with D is that we have a (more or less) stable language that
we can't make major changes to at this point.
or worse yet, a pointer in the global heap points to TLS?
Could you give an example?
I don't know Objective-C, so in D:
void* p; // in TLS
void main()
{
p = GC.malloc(1024); // a pointer to the global heap is now in TLS
}
Or the more complicated case (for any arbitrary graph of objects):
Object p; // in TLS
class C
{
Object o;
this(Object o)
{
this.o = o;
}
}
void main()
{
p = new C(new Object); // the graph can be arbitrarily complex and
any part of it can be allocated with the GC, malloc, or any other mechanism
}
I'm pretty sure it can't without doing a full pass over the entire
heap, which seems to me like it defeats the purpose.
Yeah.
Thread-local GC is all about improving scalability by only stopping
threads that need to be stopped. If you can't even do that, then any
effort towards thread-local GC is quite pointless IMO.
But I may just be missing out on some restriction (type system or
whatever) Objective-C has that makes it feasible.
--
Alex Rønne Petersen
[email protected]
http://lycus.org