summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-07 22:51:50 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-08 10:26:00 -0500
commit733e845d0f66541a06415c6b420e51fc99eb9d95 (patch)
tree7c5f7324ff148130ec9c57bee692c475f2f9d488
parent3eb737ee3f900f256a7474b199a4ab40178a8cac (diff)
downloadhaskell-733e845d0f66541a06415c6b420e51fc99eb9d95.tar.gz
CmmLayoutStack: Add unwind information on stack fixups
Currently stack fixup blocks don't include unwinding information, leaving a small window where our unwinding information is incorrect. Fix this by adding unwinding information to emitted fixup blocks. Reviewers: scpmw, simonmar, austin Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2742
-rw-r--r--compiler/cmm/CmmLayoutStack.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs
index 60f89704f0..fbd1d71cfb 100644
--- a/compiler/cmm/CmmLayoutStack.hs
+++ b/compiler/cmm/CmmLayoutStack.hs
@@ -528,8 +528,16 @@ makeFixupBlock dflags sp0 l stack tscope assigs
| otherwise = do
tmp_lbl <- newBlockId
let sp_off = sp0 - sm_sp stack
+ maybeAddUnwind block
+ | debugLevel dflags > 0
+ = block `blockSnoc` CmmUnwind [(Sp, unwind_val)]
+ | otherwise
+ = block
+ where unwind_val = cmmOffset dflags (CmmReg spReg) (sm_sp stack)
block = blockJoin (CmmEntry tmp_lbl tscope)
- (maybeAddSpAdj dflags sp_off (blockFromList assigs))
+ ( maybeAddSpAdj dflags sp_off
+ $ maybeAddUnwind
+ $ blockFromList assigs )
(CmmBranch l)
return (tmp_lbl, [block])