[commit: ghc] wip/gc/nonmoving-nonconcurrent: rts/StableName: Take stable name table lock in gcStableNameTable (809366b)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 15:12:51 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/gc/nonmoving-nonconcurrent
Link       : http://ghc.haskell.org/trac/ghc/changeset/809366b7be4fc76aff3c12a8f6aefc98cd5587b5/ghc

>---------------------------------------------------------------

commit 809366b7be4fc76aff3c12a8f6aefc98cd5587b5
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Feb 13 16:02:45 2019 -0500

    rts/StableName: Take stable name table lock in gcStableNameTable
    
    Otherwise we may potentially race with the nonmoving collector. I
    believe this was the cause of #155.


>---------------------------------------------------------------

809366b7be4fc76aff3c12a8f6aefc98cd5587b5
 rts/StableName.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/rts/StableName.c b/rts/StableName.c
index 383d87e..4b26fee 100644
--- a/rts/StableName.c
+++ b/rts/StableName.c
@@ -263,6 +263,9 @@ threadStableNameTable( evac_fn evac, void *user )
 void
 gcStableNameTable( void )
 {
+    // We must take the stable name lock lest we race with the nonmoving
+    // collector (namely nonmovingSweepStableNameTable).
+    stableNameLock();
     FOR_EACH_STABLE_NAME(
         p, {
             // FOR_EACH_STABLE_NAME traverses free entries too, so
@@ -286,6 +289,7 @@ gcStableNameTable( void )
                 }
             }
         });
+    stableNameUnlock();
 }
 
 /* -----------------------------------------------------------------------------



More information about the ghc-commits mailing list