[Gc] Basic questions

Emmanuel Stapf [ES] manus@eiffel.com
Fri, 9 May 2003 17:06:01 -0700


Hi,

I'm using the windows version of 6.1 and found that the threaded version only
supports 64 threads. I was wondering if there was a fundamental reason why no
dynamically resizing of the structure that holds thread information is performed.

Otherwise I'm trying to understand `GC_register_displacement' but the comment in
`gc.h' is rather confusing.

/* Add a displacement to the set of those considered valid by the	*/
/* collector.  GC_register_displacement(n) means that if p was returned */
/* by GC_malloc, then (char *)p + n will be considered to be a valid	*/
/* pointer to n. */

What does a pointer to `n' means?

My understanding is that if you have allocated p as:

p ------>/-------\  Offset 0
         |       |
         |       |
         |       |
         |       |
p + n -->|-------|  Offset n
         |       |
         |       |
         |       |
         |       |
         \-------/

Then the GC will consider that p is alive if it can find a pointer that points
into the first n bytes of `p'. Am I correct?

Finally I'm trying to understand the role of memory barrier, I've looked at
gc_locks.h but my understanding of assembly code is quite limited. So I wonder if
there is not some kind of paper available on the web that would explain the basic
of memory barrier and their implementation depending on the platform.

Thanks,
Manu