diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-07-16 13:39:57 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-02-17 11:21:10 -0500 |
commit | eecdb0531d98d59d5734828356e65f0d4b9b2977 (patch) | |
tree | 553f70bfe8e102143f62e1aa246792a0d147bcfc /rts | |
parent | 7bca0e545998f737c6f6eff08b2c2c38d7558976 (diff) | |
download | haskell-eecdb0531d98d59d5734828356e65f0d4b9b2977.tar.gz |
rts: TraverseHeap: Simplify profiling header
Having a union in the closure profiling header really just complicates
things so get back to basics, we just have a single StgWord there for now.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RetainerProfile.c | 2 | ||||
-rw-r--r-- | rts/RetainerProfile.h | 2 | ||||
-rw-r--r-- | rts/TraverseHeap.c | 20 | ||||
-rw-r--r-- | rts/TraverseHeap.h | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index b89519b05d..a996e8d2e2 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -251,7 +251,7 @@ associate( StgClosure *c, RetainerSet *s ) { // StgWord has the same size as pointers, so the following type // casting is okay. - RSET(c) = (RetainerSet *)((StgWord)s | flip); + RSET(c) = ((StgWord)s | flip); } static bool diff --git a/rts/RetainerProfile.h b/rts/RetainerProfile.h index ba0161c98d..e7a280fa5d 100644 --- a/rts/RetainerProfile.h +++ b/rts/RetainerProfile.h @@ -21,7 +21,7 @@ void endRetainerProfiling ( void ); void retainerProfile ( void ); // extract the retainer set field from c -#define RSET(c) ((c)->header.prof.hp.trav.rs) +#define RSET(c) ((c)->header.prof.hp.trav) static inline RetainerSet * retainerSetOf( const StgClosure *c ) diff --git a/rts/TraverseHeap.c b/rts/TraverseHeap.c index 55334e4104..4873f27c8b 100644 --- a/rts/TraverseHeap.c +++ b/rts/TraverseHeap.c @@ -19,18 +19,18 @@ /** Note [Profiling heap traversal visited bit] * * If the RTS is compiled with profiling enabled StgProfHeader can be used by - * profiling code to store per-heap object information. + * profiling code to store per-heap object information. Specifically the + * 'hp_hdr' field is used to store heap profiling information. * * The generic heap traversal code reserves the least significant bit of the - * largest members of the 'trav' union to decide whether we've already visited a - * given closure in the current pass or not. The rest of the field is free to be - * used by the calling profiler. + * heap profiling word to decide whether we've already visited a given closure + * in the current pass or not. The rest of the field is free to be used by the + * calling profiler. * - * By doing things this way we implicitly assume that the LSB of the largest - * field in the 'trav' union is insignificant. This is true at least for the - * word aligned pointers which the retainer profiler currently stores there and - * should be maintained by new users of the 'trav' union for example by shifting - * the real data up by one bit. + * By doing things this way we implicitly assume that the LSB is not used by the + * user. This is true at least for the word aligned pointers which the retainer + * profiler currently stores there and should be maintained by new users for + * example by shifting the real data up by one bit. * * Since we don't want to have to scan the entire heap a second time just to * reset the per-object visitied bit before/after the real traversal we make the @@ -49,7 +49,7 @@ StgWord flip = 0; #define setTravDataToZero(c) \ - (c)->header.prof.hp.trav.lsb = flip + (c)->header.prof.hp.trav = flip typedef enum { // Object with fixed layout. Keeps an information about that diff --git a/rts/TraverseHeap.h b/rts/TraverseHeap.h index a06a7d2f18..cc217a8858 100644 --- a/rts/TraverseHeap.h +++ b/rts/TraverseHeap.h @@ -22,7 +22,7 @@ void resetStaticObjectForProfiling(StgClosure *static_objects); extern StgWord flip; #define isTravDataValid(c) \ - ((((StgWord)(c)->header.prof.hp.trav.lsb & 1) ^ flip) == 0) + ((((StgWord)(c)->header.prof.hp.trav & 1) ^ flip) == 0) typedef struct traverseState_ traverseState; |