diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-12-09 11:40:05 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-12-09 11:40:05 +0000 |
commit | a278f3f02d09bc32b0a75d4a04d710090cde250f (patch) | |
tree | 1f6fc7dd617de453f7b0ee9b8c3f69cb74caa24b /compiler/codeGen | |
parent | 47808bdc0bae8e5ba2910c85ea6c0699af01e97c (diff) | |
download | haskell-a278f3f02d09bc32b0a75d4a04d710090cde250f.tar.gz |
Catch too-large allocations and emit an error message (#4505)
This is a temporary measure until we fix the bug properly (which is
somewhat tricky, and we think might be easier in the new code
generator).
For now we get:
ghc-stage2: sorry! (unimplemented feature or known bug)
(GHC version 7.1 for i386-unknown-linux):
Trying to allocate more than 1040384 bytes.
See: http://hackage.haskell.org/trac/ghc/ticket/4550
Suggestion: read data from a file instead of having large static data
structures in the code.
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/CgHeapery.lhs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/codeGen/CgHeapery.lhs b/compiler/codeGen/CgHeapery.lhs index 23d8852431..bc3e108347 100644 --- a/compiler/codeGen/CgHeapery.lhs +++ b/compiler/codeGen/CgHeapery.lhs @@ -433,6 +433,16 @@ do_checks :: WordOff -- Stack headroom -> CmmExpr -- Rts address to jump to on failure -> Code do_checks 0 0 _ _ = nopC + +do_checks _ hp _ _ + | hp > bLOCKS_PER_MBLOCK * bLOCK_SIZE_W + = sorry (unlines [ + "Trying to allocate more than " ++ show (bLOCKS_PER_MBLOCK * bLOCK_SIZE) ++ " bytes.", + "", + "See: http://hackage.haskell.org/trac/ghc/ticket/4550", + "Suggestion: read data from a file instead of having large static data", + "structures in the code."]) + do_checks stk hp reg_save_code rts_lbl = do_checks' (CmmLit (mkIntCLit (stk*wORD_SIZE))) (CmmLit (mkIntCLit (hp*wORD_SIZE))) |