summaryrefslogtreecommitdiff
path: root/rts/TraverseHeap.c
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-07-16 15:03:13 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-17 11:21:11 -0500
commit937feda39e0cc79cd5d23d36f5a81155d992b9f9 (patch)
treec4b590f2e883da5c8b511c27ca835642fe51be38 /rts/TraverseHeap.c
parent30c01e4227e99e10e50b05075ec071cf7950ae78 (diff)
downloadhaskell-937feda39e0cc79cd5d23d36f5a81155d992b9f9.tar.gz
rts: TraverseHeap: Make "flip" bit flip into it's own function
Diffstat (limited to 'rts/TraverseHeap.c')
-rw-r--r--rts/TraverseHeap.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/rts/TraverseHeap.c b/rts/TraverseHeap.c
index 281bf4edc2..7f5278d878 100644
--- a/rts/TraverseHeap.c
+++ b/rts/TraverseHeap.c
@@ -1162,7 +1162,6 @@ resetMutableObjects(traverseState* ts)
for (n = 0; n < n_capabilities; n++) {
for (bd = capabilities[n]->mut_lists[g]; bd != NULL; bd = bd->link) {
for (ml = bd->start; ml < bd->free; ml++) {
-
traverseMaybeInitClosureData(ts, (StgClosure *)*ml);
}
}
@@ -1172,9 +1171,7 @@ resetMutableObjects(traverseState* ts)
/**
* Traverse all closures on the traversal work-stack, calling 'visit_cb' on each
- * closure. See 'visitClosure_cb' for details. This function flips the 'flip'
- * bit and hence every closure's profiling data will be reset to zero upon
- * visiting. See Note [Profiling heap traversal visited bit].
+ * closure. See 'visitClosure_cb' for details.
*/
void
traverseWorkStack(traverseState *ts, visitClosure_cb visit_cb)
@@ -1186,9 +1183,6 @@ traverseWorkStack(traverseState *ts, visitClosure_cb visit_cb)
stackElement *sep;
bool other_children;
- // Now we flip the flip bit.
- ts->flip = ts->flip ^ 1;
-
// c = Current closure (possibly tagged)
// cp = Current closure's Parent (NOT tagged)
// data = current closures' associated data (NOT tagged)
@@ -1199,7 +1193,6 @@ loop:
if (c == NULL) {
debug("maxStackSize= %d\n", ts->maxStackSize);
- resetMutableObjects(ts);
return;
}
@@ -1401,6 +1394,22 @@ inner_loop:
}
/**
+ * This function flips the 'flip' bit and hence every closure's profiling data
+ * will be reset to zero upon visiting. See Note [Profiling heap traversal
+ * visited bit].
+ */
+void
+traverseInvalidateClosureData(traverseState* ts)
+{
+ // First make sure any unvisited mutable objects are valid so they're
+ // invalidated by the flip below
+ resetMutableObjects(ts);
+
+ // Then flip the flip bit, invalidating all closures.
+ ts->flip = ts->flip ^ 1;
+}
+
+/**
* Traverse all static objects for which we compute retainer sets,
* and reset their rs fields to NULL, which is accomplished by
* invoking traverseMaybeInitClosureData(). This function must be called