diff options
-rw-r--r-- | includes/rts/storage/Closures.h | 19 | ||||
-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 |
5 files changed, 18 insertions, 27 deletions
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h index 0fff039cc6..ebb836bca2 100644 --- a/includes/rts/storage/Closures.h +++ b/includes/rts/storage/Closures.h @@ -20,22 +20,13 @@ typedef struct { CostCentreStack *ccs; union { - - union { - /* Accessor for the least significant bit of the entire union. Invariant: - * This must be at least as large as the largest field in this union for - * this to work. If you add more fields make sure you maintain this. - * - * See Note [Profiling heap traversal visited bit]. - */ - StgWord lsb; - - /* Retainer Set */ - struct _RetainerSet *rs; - } trav; - + StgWord trav; /* Heap traversal */ StgWord ldvw; /* Lag/Drag/Void Word */ } hp; + // Heap profiling header. This field is shared among the various heap + // profiling modes. Currently it is used by ProfHeap.c for Lag/Drag/Void + // profiling and by the heap traversal modes using TraverseHeap.c such as + // the retainer profiler. } StgProfHeader; /* ----------------------------------------------------------------------------- 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; |