[commit: ghc] master: findPtr: don't search the nursery (436c0e9)

git at git.haskell.org git at git.haskell.org
Wed Jun 20 00:16:16 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/436c0e9b5e201b9121e4b48a7351dd42800eb7f3/ghc

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

commit 436c0e9b5e201b9121e4b48a7351dd42800eb7f3
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Jun 19 17:10:55 2018 -0400

    findPtr: don't search the nursery
    
    Test Plan: Used it in anger
    
    Reviewers: bgamari, erikd
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4873


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

436c0e9b5e201b9121e4b48a7351dd42800eb7f3
 rts/Printer.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/rts/Printer.c b/rts/Printer.c
index 4019ef1..291f529 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -13,6 +13,7 @@
 #include "rts/Bytecodes.h"  /* for InstrPtr */
 
 #include "sm/Storage.h"
+#include "sm/GCThread.h"
 #include "Hash.h"
 #include "Printer.h"
 #include "RtsUtils.h"
@@ -825,11 +826,16 @@ findPtr(P_ p, int follow)
   int i = 0;
   searched = 0;
 
+#if 0
+  // We can't search the nursery, because we don't know which blocks contain
+  // valid data, because the bd->free pointers in the nursery are only reset
+  // just before a block is used.
   for (n = 0; n < n_capabilities; n++) {
       bd = nurseries[i].blocks;
       i = findPtrBlocks(p,bd,arr,arr_size,i);
       if (i >= arr_size) return;
   }
+#endif
 
   for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
       bd = generations[g].blocks;
@@ -837,6 +843,13 @@ findPtr(P_ p, int follow)
       bd = generations[g].large_objects;
       i = findPtrBlocks(p,bd,arr,arr_size,i);
       if (i >= arr_size) return;
+      for (n = 0; n < n_capabilities; n++) {
+          i = findPtrBlocks(p, gc_threads[n]->gens[g].part_list,
+                            arr, arr_size, i);
+          i = findPtrBlocks(p, gc_threads[n]->gens[g].todo_bd,
+                            arr, arr_size, i);
+      }
+      if (i >= arr_size) return;
   }
   if (follow && i == 1) {
       debugBelch("-->\n");



More information about the ghc-commits mailing list