diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-06-24 21:32:56 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-09-22 15:18:10 +0200 |
commit | 44d5cc0dc456a138bb7976c17d07e5d41873051a (patch) | |
tree | caf98548cf3337fd1d01e33af3b166b1e52c5f39 /rts | |
parent | 2b76cf9e163a4fb9400b4ee5c2f8d1b27e94632c (diff) | |
download | haskell-44d5cc0dc456a138bb7976c17d07e5d41873051a.tar.gz |
rts: retainer: Abstract maxStackSize for generic traversal
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RetainerProfile.c | 13 | ||||
-rw-r--r-- | rts/TraverseHeap.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 9e9f2462ed..3fa025d19c 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -244,6 +244,9 @@ initializeTraverseStack( traverseState *ts ) ts->firstStack->link = NULL; ts->firstStack->u.back = NULL; + ts->stackSize = 0; + ts->maxStackSize = 0; + newStackBlock(ts, ts->firstStack); } @@ -260,6 +263,12 @@ closeTraverseStack( traverseState *ts ) ts->firstStack = NULL; } +int +getTraverseStackMaxSize(traverseState *ts) +{ + return ts->maxStackSize; +} + /* ----------------------------------------------------------------------------- * Returns true if the whole stack is empty. * -------------------------------------------------------------------------- */ @@ -1798,8 +1807,6 @@ retainerProfile(void) // Now we flips flip. flip = flip ^ 1; - g_retainerTraverseState.stackSize = 0; - g_retainerTraverseState.maxStackSize = 0; numObjectVisited = 0; timesAnyObjectVisited = 0; @@ -1819,7 +1826,7 @@ retainerProfile(void) stat_endRP( retainerGeneration - 1, // retainerGeneration has just been incremented! - g_retainerTraverseState.maxStackSize, + getTraverseStackMaxSize(&g_retainerTraverseState), (double)timesAnyObjectVisited / numObjectVisited); } diff --git a/rts/TraverseHeap.h b/rts/TraverseHeap.h index 5a19697694..3b90065b20 100644 --- a/rts/TraverseHeap.h +++ b/rts/TraverseHeap.h @@ -112,6 +112,7 @@ void traverseMaybeInitClosureData(StgClosure *c); void initializeTraverseStack(traverseState *ts); void closeTraverseStack(traverseState *ts); +int getTraverseStackMaxSize(traverseState *ts); W_ traverseWorkStackBlocks(traverseState *ts); |