[Gc] Uniq() test in gctest

Peter Colson pcolson at connexus.net.au
Wed Nov 10 15:37:25 PST 2004


I want to know if this test, when it emits "Apparently failed to mark 
form some function arguments. Perhaps GC_push_regs was configured 
incorrectly?" is really indicating an issue that needs to be fixed in 
GC_(generic_)push_regs (I ask because the setjmp_t test is apparently 
now out of data and unreliable, I've been told).

The test looks to be forcing a collect after 3, 4, 4, 4, 4 and 1 
malloc's on one function call:

uniq(GC_malloc(12), GC_malloc(12), GC_malloc(12),
          (GC_gcollect(),GC_malloc(12)),
          GC_malloc(12), GC_malloc(12), GC_malloc(12),
          (GC_gcollect(),GC_malloc(12)),
          GC_malloc(12), GC_malloc(12), GC_malloc(12),
          (GC_gcollect(),GC_malloc(12)),
          GC_malloc(12), GC_malloc(12), GC_malloc(12),
          (GC_gcollect(),GC_malloc(12)),
          GC_malloc(12), GC_malloc(12), GC_malloc(12),
          (GC_gcollect(),GC_malloc(12)),
          (void *)0);

My debug results follow (see end) - I've inserted the '(collects)' 
where I assumed they were occurring.

The same address appears at q[3] as was in q[1]. So presumably a 
collect occurred allowing the same pointer that was previously returned 
for the q[1] malloc to be reclaimed and returned again to satisy the 
q[3] malloc, correct?

What does this indicate in terms of GC_(generic_)push_regs not being 
correctly configured given that, in this case, the generic one is being 
used? To me it says that the pointers malloc'ed and passed to a 
function should not be collected until the function has been called and 
subsequently returned, so those pointers passed (potentially in 
registers) need to be marked so as to prevent them being reclaimed.

Is this entirely the responsibility of GC_(generic_)push_regs or are 
other parts of the GC involved (maybe related to GC_stackbottom)?

===================
Uniq() test output:

q[0] = 0x80040fdff0
q[1] = 0x80040fdfe0
q[2] = 0x80040fdfd0
(collect)
q[3] = 0x80040fdfe0
q[4] = 0x80040fdfc0
q[5] = 0x80040fdfb0
q[6] = 0x80040fdfa0
(collect)
q[7] = 0x80040fdff0
q[8] = 0x80040fdfd0
q[9] = 0x80040fdfc0
q[10] = 0x80040fdfb0
(collect)
q[11] = 0x80040fdfe0
q[12] = 0x80040fdfd0
q[13] = 0x80040fdfc0
q[14] = 0x80040fdfa0
(collect)
q[15] = 0x80040fdff0
q[16] = 0x80040fdfd0
q[17] = 0x80040fdfc0
q[18] = 0x80040fdfb0
(collect)
q[19] = 0x80040fdfe0
n = 20

i = 0,

i = 1,
j = 0, q[1] = 0x80040fdfe0, q[0] = 0x80040fdff0

i = 2,
j = 0, q[2] = 0x80040fdfd0, q[0] = 0x80040fdff0
j = 1, q[2] = 0x80040fdfd0, q[1] = 0x80040fdfe0

i = 3,
j = 0, q[3] = 0x80040fdfe0, q[0] = 0x80040fdff0
j = 1, q[3] = 0x80040fdfe0, q[1] = 0x80040fdfe0

Apparently failed to mark form some function arguments.
Perhaps GC_push_regs was configured incorrectly?


Regards,
Peter Colson.



More information about the Gc mailing list