From f85ef2f16e07b6ad4ae727f23a7ed71d258f5e8f Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 12 Jul 2005 13:34:03 +0000 Subject: [PATCH] [project @ 2005-07-12 13:34:03 by simonmar] schedulDoGC: when traversing the all_threads list checking for invalid transactions we were bogusly following the link field rather than the global_link field. --- ghc/rts/Schedule.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index ea791e5..d35bac5 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1930,19 +1930,28 @@ scheduleDoGC( rtsBool force_major ) * atomically frames. When next scheduled they will try to * commit, this commit will fail and they will retry. */ - for (t = all_threads; t != END_TSO_QUEUE; t = t -> link) { - if (t -> what_next != ThreadRelocated && t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { - if (!stmValidateNestOfTransactions (t -> trec)) { - IF_DEBUG(stm, sched_belch("trec %p found wasting its time", t)); - - // strip the stack back to the ATOMICALLY_FRAME, aborting - // the (nested) transaction, and saving the stack of any - // partially-evaluated thunks on the heap. - raiseAsync_(t, NULL, rtsTrue); - + { + StgTSO *next; + + for (t = all_threads; t != END_TSO_QUEUE; t = next) { + if (t->what_next == ThreadRelocated) { + next = t->link; + } else { + next = t->global_link; + if (t -> trec != NO_TREC && t -> why_blocked == NotBlocked) { + if (!stmValidateNestOfTransactions (t -> trec)) { + IF_DEBUG(stm, sched_belch("trec %p found wasting its time", t)); + + // strip the stack back to the ATOMICALLY_FRAME, aborting + // the (nested) transaction, and saving the stack of any + // partially-evaluated thunks on the heap. + raiseAsync_(t, NULL, rtsTrue); + #ifdef REG_R1 - ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME); + ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME); #endif + } + } } } } -- 1.7.10.4