summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmLayoutStack.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-07 22:56:36 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-08 10:26:00 -0500
commit3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b (patch)
tree3bb04ff1f086a95e8f93041d13a10af7ec1f9011 /compiler/cmm/CmmLayoutStack.hs
parent733e845d0f66541a06415c6b420e51fc99eb9d95 (diff)
downloadhaskell-3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b.tar.gz
Cmm: Add support for undefined unwinding statements
And use to mark `stg_stack_underflow_frame`, which we are unable to determine a caller from. To simplify parsing at the moment we steal the `return` keyword to indicate an undefined unwind value. Perhaps this should be revisited. Reviewers: scpmw, simonmar, austin, erikd Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2738
Diffstat (limited to 'compiler/cmm/CmmLayoutStack.hs')
-rw-r--r--compiler/cmm/CmmLayoutStack.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs
index fbd1d71cfb..f59daad64d 100644
--- a/compiler/cmm/CmmLayoutStack.hs
+++ b/compiler/cmm/CmmLayoutStack.hs
@@ -530,7 +530,7 @@ makeFixupBlock dflags sp0 l stack tscope assigs
let sp_off = sp0 - sm_sp stack
maybeAddUnwind block
| debugLevel dflags > 0
- = block `blockSnoc` CmmUnwind [(Sp, unwind_val)]
+ = block `blockSnoc` CmmUnwind [(Sp, Just unwind_val)]
| otherwise
= block
where unwind_val = cmmOffset dflags (CmmReg spReg) (sm_sp stack)
@@ -805,9 +805,10 @@ manifestSp dflags stackmaps stack0 sp0 sp_high
-- Add unwind pseudo-instructions at the beginning of each block to
-- document Sp level for debugging
add_unwind_info block
- | debugLevel dflags > 0 =
- CmmUnwind [(Sp, sp_unwind)] : block
- | otherwise = block
+ | debugLevel dflags > 0
+ = CmmUnwind [(Sp, Just sp_unwind)] : block
+ | otherwise
+ = block
sp_unwind = CmmRegOff (CmmGlobal Sp) (sp0 - wORD_SIZE dflags)
final_middle = maybeAddSpAdj dflags sp_off