# HG changeset patch # User kaltenbach # Date 1067698500 0 # Node ID aa0db78e67c4afa73831227c418141bc4d4f9f40 # Parent c6b9198bfc2356f8dde53d9e45241785ace28917 [xemacs-hg @ 2003-11-01 14:54:53 by kaltenbach] Bugfix in USE_KKCC mode processing weak data structures 2003-11-01 Markus Kaltenbach * src/alloc.c (garbage_collect_1):fix bug * automated/weak-tests.el:added test to track it down diff -r c6b9198bfc23 -r aa0db78e67c4 src/ChangeLog --- a/src/ChangeLog Fri Oct 31 22:51:31 2003 +0000 +++ b/src/ChangeLog Sat Nov 01 14:55:00 2003 +0000 @@ -1,3 +1,11 @@ +2003-11-01 Markus Kaltenbach + + * alloc.c (garbage_collect_1): + move kkcc_marking() call inside the while loop containing all + the iterative calls for marking weak data structures since the + entries on the kkcc_stack need to be processed after every run + to mark attached objects + 2003-10-16 Jerry James * realpath.c (qxe_realpath): When a symbolic link to an absolute diff -r c6b9198bfc23 -r aa0db78e67c4 src/alloc.c --- a/src/alloc.c Fri Oct 31 22:51:31 2003 +0000 +++ b/src/alloc.c Sat Nov 01 14:55:00 2003 +0000 @@ -4613,10 +4613,12 @@ while (finish_marking_weak_hash_tables () > 0 || finish_marking_weak_lists () > 0 || continue_marking_ephemerons () > 0) +#ifdef USE_KKCC + { + kkcc_marking (); + } +#else /* NOT USE_KKCC */ ; - -#ifdef USE_KKCC - kkcc_marking (); #endif /* USE_KKCC */ /* At this point, we know which objects need to be finalized: we @@ -4625,12 +4627,14 @@ while (finish_marking_ephemerons () > 0 || finish_marking_weak_lists () > 0 || finish_marking_weak_hash_tables () > 0) - ; - #ifdef USE_KKCC - kkcc_marking (); + { + kkcc_marking (); + } kkcc_gc_stack_free (); #undef mark_object +#else /* NOT USE_KKCC */ + ; #endif /* USE_KKCC */ /* And prune (this needs to be called after everything else has been diff -r c6b9198bfc23 -r aa0db78e67c4 tests/ChangeLog --- a/tests/ChangeLog Fri Oct 31 22:51:31 2003 +0000 +++ b/tests/ChangeLog Sat Nov 01 14:55:00 2003 +0000 @@ -1,3 +1,9 @@ +2003-11-01 Markus Kaltenbach + + * automated/weak-tests.el: + Added testing of the iterative marking calls needed for processing + weak data structures, especially ephemerons, correctly + 2003-10-22 Vin Shelton * automated/hash-table-tests.el: Remove debugging print diff -r c6b9198bfc23 -r aa0db78e67c4 tests/automated/weak-tests.el --- a/tests/automated/weak-tests.el Fri Oct 31 22:51:31 2003 +0000 +++ b/tests/automated/weak-tests.el Sat Nov 01 14:55:00 2003 +0000 @@ -222,3 +222,26 @@ (Assert (equal (weak-list-list weaklist4) testlist))) (garbage-collect) + +;; test the intended functionality of the fixpoint iteration used for marking +;; weak data structures like the ephermerons. Basically this tests gc_internals +;; to work properly but it also ensures the ephemerons behave according to the +;; specification + +(let* ((inner_cons (cons 1 2)) + (weak1 (make-ephemeron inner_cons + (make-ephemeron inner_cons + (cons 1 2) + '(lambda (v) t)) + '(lambda (v) t)))) + (Assert (ephemeron-ref (ephemeron-ref weak1))) + (garbage-collect) + ;; assure the inner ephis are still there + (Assert (ephemeron-ref (ephemeron-ref weak1))) + ;; delete the key reference and force cleaning up the garbage + (setq inner_cons (cons 3 4)) + (garbage-collect) + (Assert (not (ephemeron-ref weak1))) +) + +(garbage-collect)