summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2018-09-21 09:33:38 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2018-09-21 09:34:11 +0300
commit66c17293648fd03a04aabfd807b3c8336e8f843a (patch)
treedd9d4e10f6dc70117a85f7585f288398a7a4615a /rts
parenta257782f56e5e330349d4cc7db71e297d8396c67 (diff)
downloadhaskell-66c17293648fd03a04aabfd807b3c8336e8f843a.tar.gz
Fix slop zeroing for AP_STACK eager blackholes in debug build
As #15571 reports, eager blackholing breaks sanity checks as we can't zero the payload when eagerly blackholing (because we'll be using the payload after blackholing), but by the time we blackhole a previously eagerly blackholed object (in `threadPaused()`) we don't have the correct size information for the object (because the object's type becomes BLACKHOLE when we eagerly blackhole it) so can't properly zero the slop. This problem can be solved for AP_STACK eager blackholing (which unlike eager blackholing in general, is not optional) by zeroing the payload after entering the stack. This patch implements this idea. Fixes #15571. Test Plan: Previously concprog001 when compiled and run with sanity checks ghc-stage2 Mult.hs -debug -rtsopts ./Mult +RTS -DS was failing with Mult: internal error: checkClosure: stack frame (GHC version 8.7.20180821 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug thic patch fixes this panic. The test still panics, but it runs for a while before panicking (instead of directly panicking as before), and the new problem seems unrelated: Mult: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 296 (GHC version 8.7.20180919 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug The new problem will be fixed in another diff. I also tried slow validate (which requires D5164): this does not introduce any new failures. Reviewers: simonmar, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15571 Differential Revision: https://phabricator.haskell.org/D5165
Diffstat (limited to 'rts')
-rw-r--r--rts/Apply.cmm5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/Apply.cmm b/rts/Apply.cmm
index 15d8250f52..40f890d342 100644
--- a/rts/Apply.cmm
+++ b/rts/Apply.cmm
@@ -679,6 +679,11 @@ for:
R1 = StgAP_STACK_fun(ap);
+ // Because of eager blackholing the closure no longer has correct size so
+ // threadPaused() can't correctly zero the slop, so we do it here. See #15571
+ // and Note [zeroing slop].
+ OVERWRITING_CLOSURE_SIZE(ap, BYTES_TO_WDS(SIZEOF_StgThunkHeader) + 2 + Words);
+
ENTER_R1();
}