[commit: ghc] master: Fix comments about scavenging WEAK objects (7c0b595)

git at git.haskell.org git at git.haskell.org
Thu May 12 15:30:37 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7c0b595e55d31f9f89e6dede11981e942c5bb32f/ghc

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

commit 7c0b595e55d31f9f89e6dede11981e942c5bb32f
Author: Takano Akio <tak at anoak.io>
Date:   Thu May 12 15:45:44 2016 +0200

    Fix comments about scavenging WEAK objects
    
    This is a follow-up of D2189. If fixes some comments, deletes a section
    in the User's Guide about the bug, and updates .mailmap as suggested on
    the WorkinConventions wiki page.
    
    Test Plan: It compiles.
    
    Reviewers: austin, simonmar, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2202
    
    GHC Trac Issues: #11108


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

7c0b595e55d31f9f89e6dede11981e942c5bb32f
 .mailmap                  | 1 +
 docs/users_guide/bugs.rst | 5 -----
 rts/sm/MarkWeak.c         | 8 +-------
 rts/sm/Scav.c             | 4 ++++
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/.mailmap b/.mailmap
index 5ea062b..81dec3d 100644
--- a/.mailmap
+++ b/.mailmap
@@ -242,6 +242,7 @@ Sven Panne              <sven.panne at aedion.de>              panne <unknown>
 Sven Panne              <sven.panne at aedion.de>              sven.panne at aedion.de <unknown>
 Sylvain Henry           <hsyl20 at gmail.com>
 Sébastien Carlier       <sebc at posse42.net>                  sebc <unknown>
+Takano Akio             <tak at anoak.io>                      <aljee at hyper.cx>
 Thorkil Naur            <naur at post11.tele.dk>               naur at post11.tele.dk <unknown>
 Tibor Erdesz            <erdeszt at gmail.com>
 Tim Chevalier           <chevalier at alum.wellesley.edu>
diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst
index c4ac9ce..ff83725 100644
--- a/docs/users_guide/bugs.rst
+++ b/docs/users_guide/bugs.rst
@@ -486,11 +486,6 @@ Bugs in GHC
      data A :: Type where
        B :: forall (a :: A). A
 
--  There is known to be maleficent interactions between weak references and
-   laziness. Particularly, it has been observed that placing a thunk containing
-   a reference to a weak reference inside of another weak reference may cause
-   runtime crashes. See :ghc-ticket:`11108` for details.
-
 .. _bugs-ghci:
 
 Bugs in GHCi (the interactive GHC)
diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c
index 2393536..7e3e1d5 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -269,13 +269,7 @@ static rtsBool tidyWeakList(generation *gen)
                 gct->evac_gen_no = new_gen->no;
                 gct->failed_to_evac = rtsFalse;
 
-                // evacuate the value and finalizer
-                //
-                // This WEAK object will not be considered by tidyWeakList
-                // during this collection because it is in a generation >= N,
-                // but it is on the mutable list so we must evacuate all of its
-                // pointers because some of them may point into a younger
-                // generation.
+                // evacuate the fields of the weak ptr
                 scavengeLiveWeak(w);
 
                 if (gct->failed_to_evac) {
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index b046f39..7a799d6 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -1300,6 +1300,10 @@ scavenge_one(StgPtr p)
     }
 
     case WEAK:
+        // This WEAK object will not be considered by tidyWeakList during this
+        // collection because it is in a generation >= N, but it is on the
+        // mutable list so we must evacuate all of its pointers because some
+        // of them may point into a younger generation.
         scavengeLiveWeak((StgWeak *)p);
         break;
 



More information about the ghc-commits mailing list