Skip to content
Snippets Groups Projects
Commit 38a4b6ab authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

rts: Fix SET_HDR initialization of retainer set

This fixes a regression in retainer set profiling introduced by
b0293f78. Prior to that commit
the heap traversal word would be initialized by `SET_HDR` using
`LDV_RECORD_CREATE`. However, the commit added a `doingLDVProfiling`
check in `LDV_RECORD_CREATE`, meaning that this initialization no longer
happened.

Given that this initialization was awkwardly indirectly anyways, I have
fixed this by explicitly initializating the heap traversal word to
`NULL` in `SET_PROF_HDR`. This is equivalent to the previous behavior,
but much more direct.

Fixes #24513.
parent 50454a29
No related branches found
No related tags found
No related merge requests found
......@@ -147,17 +147,10 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con)
#if defined(PROFILING)
/*
The following macro works for both retainer profiling and LDV profiling. For
retainer profiling, 'era' remains 0, so by setting the 'ldvw' field we also set
'rs' to zero.
Note that we don't have to bother handling the 'flip' bit properly[1] since the
retainer profiling code will just set 'rs' to NULL upon visiting a closure with
an invalid 'flip' bit anyways.
See Note [Profiling heap traversal visited bit] for details.
[1]: Technically we should set 'rs' to `NULL | flip`.
retainer profiling, we set 'trav' to 0, which is an invalid
RetainerSet.
*/
/*
MP: Various other places use the check era > 0 to check whether LDV profiling
is enabled. The use of these predicates here is the reason for including RtsFlags.h in
......@@ -168,17 +161,14 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con)
*/
#define SET_PROF_HDR(c, ccs_) \
{ \
(c)->header.prof.ccs = ccs_; \
if (doingLDVProfiling()) { \
LDV_RECORD_CREATE((c)); \
} \
\
if (doingRetainerProfiling()) { \
LDV_RECORD_CREATE((c)); \
}; \
if (doingErasProfiling()){ \
ERA_RECORD_CREATE((c)); \
}; \
(c)->header.prof.ccs = ccs_; \
if (doingLDVProfiling()) { \
LDV_RECORD_CREATE((c)); \
} else if (doingRetainerProfiling()) { \
(c)->header.prof.hp.trav = 0; \
} else if (doingErasProfiling()){ \
ERA_RECORD_CREATE((c)); \
} \
}
#else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment