On Wed, 29 Dec 2010 07:37:10 -0700, Steven Schveighoffer <[email protected]> wrote:

On Tue, 28 Dec 2010 01:23:22 -0500, Robert Jacques <[email protected]> wrote:

First, I'd like to point out that precise scanning of the heap (and I'll assume this can be extended to globals), is a long standing enhancement request.

Yes, I know. Does it also do precise scanning of the stack and global/TLS data? Because that also needs to happen (I think you need a lot more compiler support for that) to really fix this problem.

Globals and TLS should be possible, but the stack isn't without some major architectural changes (tagging+filtering, dual-stacks, etc).

Second, the false pointer problem disappears (for practical purposes) when you move to 64-bit.

I'm not sure I like this "solution", but you are correct. This is somewhat mitigated however by the way memory is allocated (I'm assuming not sparsely throughout the address space, and also low in the address space). It certainly makes it less likely that a 64-bit random long points at data, but it's not inconceivable to have 32-bits of 0 interspersed with non-zero data. It might be likely to have a struct with two ints back to back, where one int is frequently 0.

Ah, but the GC can allocate ram in any section of the address space it wants, so it would be easy for the upper 32-bits to be always non-zero by design.

Third, modern GCs (i.e. thread-local GCs) can further reduce the false pointer issue.

I'd rather have precise scanning :) There are issues with thread-local GCs.

The only issue with thread-local GCs is that you can't cast to immutable and then shared the result across threads. And eventually, well have a) better ways of constructing immutable and b) a deep idup, to mitigate this.

If we have the typeinfo of a memory block for the GC to parse, you can also rule out cross-thread pointers without thread-local GCs (for unshared data).

Which basically creates all the problems of thread-local GC, with very few of the advantages.

For clarity's sake, I assume that thread-local GCs would be used in conjunction with a standard shared GC, in order to handle immutable and shared heap data correctly.

Reply via email to