diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-07-16 13:49:16 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-02-17 11:21:10 -0500 |
commit | d7bbaf5d45fd7b88ce331659abe29d16d086684b (patch) | |
tree | 9e3dd30895822ba3f01972008d6313803d6852aa /rts/TraverseHeap.c | |
parent | eecdb0531d98d59d5734828356e65f0d4b9b2977 (diff) | |
download | haskell-d7bbaf5d45fd7b88ce331659abe29d16d086684b.tar.gz |
rts: TraverseHeap: Make trav. data macros into functions
This allows the global 'flip' variable not to be exported. This allows a
future commit to also make it part of the traversalState struct.
Diffstat (limited to 'rts/TraverseHeap.c')
-rw-r--r-- | rts/TraverseHeap.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/rts/TraverseHeap.c b/rts/TraverseHeap.c index 4873f27c8b..110cae3b34 100644 --- a/rts/TraverseHeap.c +++ b/rts/TraverseHeap.c @@ -46,10 +46,23 @@ * mutable data. There we do just go over all existing objects to reset the bit * manually. See 'resetStaticObjectForProfiling' and 'resetMutableObjects'. */ -StgWord flip = 0; +static StgWord flip = 0; -#define setTravDataToZero(c) \ - (c)->header.prof.hp.trav = flip +StgWord getTravData(const StgClosure *c) +{ + const StgWord hp_hdr = c->header.prof.hp.trav; + return hp_hdr & (STG_WORD_MAX ^ 1); +} + +void setTravData(StgClosure *c, StgWord w) +{ + c->header.prof.hp.trav = w | flip; +} + +bool isTravDataValid(const StgClosure *c) +{ + return ((c->header.prof.hp.trav & 1) ^ flip) == 0; +} typedef enum { // Object with fixed layout. Keeps an information about that @@ -949,7 +962,7 @@ bool traverseMaybeInitClosureData(StgClosure *c) { if (!isTravDataValid(c)) { - setTravDataToZero(c); + setTravData(c, 0); return true; } return false; |