diff --git a/src/gc.c b/src/gc.c index c8e6fa239ca5a4b4d3b4e084915c67497324d5e3..63e50dcb5912ee0e331015338cdf159be9f6de7e 100644 --- a/src/gc.c +++ b/src/gc.c @@ -29,7 +29,7 @@ struct callback *gc_evaluator_callback=0; #include "block_alloc.h" -RCSID("$Id: gc.c,v 1.95 2000/06/12 21:41:41 mast Exp $"); +RCSID("$Id: gc.c,v 1.96 2000/06/12 23:00:31 mast Exp $"); /* Run garbage collect approximately every time * 20 percent of all arrays, objects and programs is @@ -1254,12 +1254,17 @@ int gc_cycle_push(void *x, struct marker *m, int weak) if (cycle == gc_rec_last->cycle) CYCLE_DEBUG_MSG(m, "gc_cycle_push, old cycle"); else { + unsigned replace_cycle = gc_rec_last->cycle; CYCLE_DEBUG_MSG(m, "gc_cycle_push, cycle"); - for (p = m;; p = p->link) { + for (p = m; p != gc_rec_last; p = p->link) { p->cycle = cycle; CYCLE_DEBUG_MSG(p, "gc_cycle_push, mark cycle"); - if (p == gc_rec_last) break; - }}}} /* Mmm.. lisp ;) */ + } + if (replace_cycle != cycle) + for (; p && p->cycle == replace_cycle; p = p->link) { + p->cycle = cycle; + CYCLE_DEBUG_MSG(p, "gc_cycle_push, re-mark cycle"); + }}}} /* Mmm.. lisp ;) */ else /* A forward reference. */ if (m->flags & GC_ON_STACK) { diff --git a/src/testsuite.in b/src/testsuite.in index 9164f631e5d0726d3541a060f9ad166629e74679..83d0e0487efca73398d01a92fd5db1ac10d91004 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.302 2000/06/12 21:41:41 mast Exp $"]]); +test_true([["$Id: testsuite.in,v 1.303 2000/06/12 23:00:32 mast Exp $"]]); cond([[all_constants()->_verify_internals]], [[ @@ -2333,6 +2333,16 @@ ifefun(gc, dead[1]->x = dead[1], dead[1]->y = dead_nested[1]; dead_nested[0]->y = live[0], dead_nested[0]->x = dead_nested[1]; }}), + ({3, 0, 0, 0, lambda() { // 62 + live[0]->x = live[1]; + live[1]->x = live[0], live[1]->y = live[2]; + live[2]->x = live[1]; + }}), + ({3, 0, 0, 0, lambda() { // 63 + live[0]->x = live[1]; + live[1]->y = live[0], live[1]->x = live[2]; + live[2]->x = live[1]; + }}), // ({3, 0, 0, 0, lambda() { // Not possible without weak refs directly in objects. // live[0]->x = live[0], live[0]->v[0] = live[1]; // live[1]->x = live[1], live[1]->w[0] = live[2];