[commit: ghc] master: StgCmmHeap: Re-add check for large static allocations (c1d7b4b)
git at git.haskell.org
git at git.haskell.org
Sat Aug 29 11:25:57 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/c1d7b4b43bbc4c7a590a8b942adc09e654d0659d/ghc
>---------------------------------------------------------------
commit c1d7b4b43bbc4c7a590a8b942adc09e654d0659d
Author: Ben Gamari <ben at smart-cactus.org>
Date: Thu Aug 27 14:08:01 2015 +0200
StgCmmHeap: Re-add check for large static allocations
This should at least help alleviate the annoyance of #4505. This
reintroduces a compile-time check originally added in
a278f3f02d09bc32b0a75d4a04d710090cde250f but dropped with the new code
generator.
>---------------------------------------------------------------
c1d7b4b43bbc4c7a590a8b942adc09e654d0659d
compiler/codeGen/StgCmmHeap.hs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs
index 4b2bd96..6aaa100 100644
--- a/compiler/codeGen/StgCmmHeap.hs
+++ b/compiler/codeGen/StgCmmHeap.hs
@@ -46,6 +46,7 @@ import Id ( Id )
import Module
import DynFlags
import FastString( mkFastString, fsLit )
+import Panic( sorry )
#if __GLASGOW_HASKELL__ >= 709
import Prelude hiding ((<*>))
@@ -532,8 +533,16 @@ heapCheck checkStack checkYield do_gc code
-- that the conditionals on hpHw don't cause a black hole
do { dflags <- getDynFlags
; let mb_alloc_bytes
+ | hpHw > mBLOCK_SIZE = sorry $ unlines
+ [" Trying to allocate more than "++show mBLOCK_SIZE++" bytes.",
+ "",
+ "This is currently not possible due to a limitation of GHC's code generator.",
+ "See http://hackage.haskell.org/trac/ghc/ticket/4505 for details.",
+ "Suggestion: read data from a file instead of having large static data",
+ "structures in code."]
| hpHw > 0 = Just (mkIntExpr dflags (hpHw * (wORD_SIZE dflags)))
| otherwise = Nothing
+ where mBLOCK_SIZE = bLOCKS_PER_MBLOCK dflags * bLOCK_SIZE_W dflags
stk_hwm | checkStack = Just (CmmLit CmmHighStackMark)
| otherwise = Nothing
; codeOnly $ do_checks stk_hwm checkYield mb_alloc_bytes do_gc
More information about the ghc-commits
mailing list