diff --git a/LOG b/LOG index 9d998e1ee6..1fbb59e9e3 100644 --- a/LOG +++ b/LOG @@ -438,3 +438,5 @@ of the same to the COMMAND-LINE OPTIONS section of the man page. did a bit of minor cleanup elsewhere in the man page. use.stex, scheme.1.in +- destroy_thread now processes guardian entries + thread.c, 4.ms, release_notes.stex diff --git a/c/thread.c b/c/thread.c index 3b89c54e25..e4ff613f58 100644 --- a/c/thread.c +++ b/c/thread.c @@ -172,6 +172,21 @@ static IBOOL destroy_thread(tc) ptr tc; { /* process remembered set before dropping allocation area */ S_scan_dirty((ptr **)EAP(tc), (ptr **)REAL_EAP(tc)); + /* process guardian entries */ + { + ptr target, ges, obj, next; seginfo *si; + target = S_G.guardians[0]; + for (ges = GUARDIANENTRIES(tc); ges != Snil; ges = next) { + obj = GUARDIANOBJ(ges); + next = GUARDIANNEXT(ges); + if (!IMMEDIATE(obj) && (si = MaybeSegInfo(ptr_get_segment(obj))) != NULL && si->generation != static_generation) { + INITGUARDIANNEXT(ges) = target; + target = ges; + } + } + S_G.guardians[0] = target; + } + /* deactivate thread */ if (ACTIVE(tc)) { SETSYMVAL(S_G.active_threads_id, @@ -185,6 +200,7 @@ static IBOOL destroy_thread(tc) ptr tc; { free((void *)THREADTC(thread)); THREADTC(thread) = 0; /* mark it dead */ status = 1; + break; } ls = &Scdr(*ls); } diff --git a/mats/4.ms b/mats/4.ms index 0d4c526573..b29cbb7edd 100644 --- a/mats/4.ms +++ b/mats/4.ms @@ -2992,6 +2992,17 @@ (collect 0 0) (list ((g1)) p))))) '((c d) (b))) + + (or (not (threaded?)) + (equal? + (parameterize ([collect-request-handler void]) + (let ([g (make-guardian)]) + (fork-thread (lambda () (g (list 'a 'b)))) + (let f () (when (> #%$active-threads 1) (f))) + (collect) + (g))) + '(a b))) + (parameterize ([collect-request-handler void] [enable-object-counts #t]) (define-record-type fraz (fields zle)) (define g (make-guardian)) diff --git a/release_notes/release_notes.stex b/release_notes/release_notes.stex index eb5d7f0dc9..1000ffb63f 100644 --- a/release_notes/release_notes.stex +++ b/release_notes/release_notes.stex @@ -1490,6 +1490,12 @@ in fasl files does not generally make sense. %----------------------------------------------------------------------------- \section{Bug Fixes}\label{section:bugfixes} +\subsection{Missing guardian entries when a thread exits (9.4.1)} + +A bug that causes guardian entries for a thread to be lost when a +thread exits has been fixed. +[This bug dated back to Version 6.5.] + \subsection{Incorrect code for certain nested \protect\scheme{if} patterns (9.4.1)} A bug in the source optimizer that produced incorrect code for certain