[Git][ghc/ghc][wip/tsan/codegen] nonmoving: Use correct lock

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Nov 16 17:30:52 UTC 2022



Ben Gamari pushed to branch wip/tsan/codegen at Glasgow Haskell Compiler / GHC


Commits:
062fc2da by Ben Gamari at 2022-11-16T12:30:39-05:00
nonmoving: Use correct lock

- - - - -


1 changed file:

- rts/sm/NonMoving.c


Changes:

=====================================
rts/sm/NonMoving.c
=====================================
@@ -904,7 +904,7 @@ static void nonmovingPrepareMark(void)
 static void nonmovingMarkWeakPtrList(MarkQueue *mark_queue, StgWeak *dead_weak_ptr_list)
 {
     for (StgWeak *w = oldest_gen->weak_ptr_list; w; w = w->link) {
-        markQueuePushClosure_(mark_queue, (StgClosure*)w);
+        markQueuePushClosureGC(mark_queue, (StgClosure*)w);
         // Do not mark finalizers and values here, those fields will be marked
         // in `nonmovingMarkDeadWeaks` (for dead weaks) or
         // `nonmovingTidyWeaks` (for live weaks)
@@ -923,8 +923,14 @@ static void nonmovingMarkWeakPtrList(MarkQueue *mark_queue, StgWeak *dead_weak_p
     // - So, to be able to traverse `dead_weak_ptr_list` and run finalizers we
     //   need to mark it.
     for (StgWeak *w = dead_weak_ptr_list; w; w = w->link) {
-        markQueuePushClosure_(mark_queue, (StgClosure*)w);
-        nonmovingMarkDeadWeak(mark_queue, w);
+        markQueuePushClosureGC(mark_queue, (StgClosure*)w);
+
+        // Mark the value and finalizer since they will be needed regardless of
+        // whether we find the weak is live.
+        if (w->cfinalizers != &stg_NO_FINALIZER_closure) {
+            markQueuePushClosureGC(queue, w->value);
+        }
+        markQueuePushClosureGC(queue, w->finalizer);
     }
 }
 
@@ -966,7 +972,7 @@ void nonmovingCollect(StgWeak **dead_weaks, StgTSO **resurrected_threads)
 
     // Mark threads resurrected during moving heap scavenging
     for (StgTSO *tso = *resurrected_threads; tso != END_TSO_QUEUE; tso = tso->global_link) {
-        markQueuePushClosure_(mark_queue, (StgClosure*)tso);
+        markQueuePushClosureGC(mark_queue, (StgClosure*)tso);
     }
     trace(TRACE_nonmoving_gc, "Finished marking roots for nonmoving GC");
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/062fc2da0ba9de1c4e7c7b033c84f5cfd16d91a0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/062fc2da0ba9de1c4e7c7b033c84f5cfd16d91a0
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221116/7d6eb456/attachment-0001.html>


More information about the ghc-commits mailing list