Skip to content
Snippets Groups Projects
Commit 3e75b0db authored by GHC GitLab CI's avatar GHC GitLab CI Committed by Ben Gamari
Browse files

ThreadPaused: Don't zero slop until free vars are pushed

When threadPaused blackholes a thunk it calls `OVERWRITING_CLOSURE` to
zero the slop for the benefit of the sanity checker. Previously this was
done *before* pushing the thunk's free variables to the update
remembered set. Consequently we would pull zero'd pointers to the update
remembered set.
parent a1a75aa9
No related branches found
No related tags found
No related merge requests found
......@@ -520,11 +520,15 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n)
#if defined(PROFILING) || defined(DEBUG)
#define OVERWRITING_CLOSURE(c) \
overwritingClosure(c)
#define OVERWRITING_CLOSURE_SIZE(c, size) \
overwritingClosureSize(c, size)
#define OVERWRITING_CLOSURE_MUTABLE(c, off) \
overwritingMutableClosureOfs(c, off)
#else
#define OVERWRITING_CLOSURE(c) \
do { (void) sizeof(c); } while(0)
#define OVERWRITING_CLOSURE_SIZE(c, size) \
do { (void) sizeof(c); (void) sizeof(size); } while(0)
#define OVERWRITING_CLOSURE_MUTABLE(c, off) \
do { (void) sizeof(c); (void) sizeof(off); } while(0)
#endif
......
......@@ -314,10 +314,6 @@ threadPaused(Capability *cap, StgTSO *tso)
continue;
}
// zero out the slop so that the sanity checker can tell
// where the next closure is.
OVERWRITING_CLOSURE(bh);
// an EAGER_BLACKHOLE or CAF_BLACKHOLE gets turned into a
// BLACKHOLE here.
#if defined(THREADED_RTS)
......@@ -345,11 +341,16 @@ threadPaused(Capability *cap, StgTSO *tso)
// overwrite to the update remembered set.
// N.B. We caught the WHITEHOLE case above.
updateRemembSetPushThunkEager(cap,
THUNK_INFO_PTR_TO_STRUCT(bh_info),
(StgThunk *) bh);
THUNK_INFO_PTR_TO_STRUCT(bh_info),
(StgThunk *) bh);
}
}
// zero out the slop so that the sanity checker can tell
// where the next closure is. N.B. We mustn't do this until we have
// pushed the free variables to the update remembered set above.
OVERWRITING_CLOSURE_SIZE(bh, closure_sizeW_(bh, INFO_PTR_TO_STRUCT(bh_info)));
// The payload of the BLACKHOLE points to the TSO
RELAXED_STORE(&((StgInd *)bh)->indirectee, (StgClosure *)tso);
SET_INFO_RELEASE(bh,&stg_BLACKHOLE_info);
......
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