summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-12-09 11:40:05 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-12-09 11:40:05 +0000
commita278f3f02d09bc32b0a75d4a04d710090cde250f (patch)
tree1f6fc7dd617de453f7b0ee9b8c3f69cb74caa24b /includes
parent47808bdc0bae8e5ba2910c85ea6c0699af01e97c (diff)
downloadhaskell-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 'includes')
-rw-r--r--includes/HaskellConstants.hs5
-rw-r--r--includes/mkDerivedConstants.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/includes/HaskellConstants.hs b/includes/HaskellConstants.hs
index 4555b474bf..51cdcaf0d1 100644
--- a/includes/HaskellConstants.hs
+++ b/includes/HaskellConstants.hs
@@ -183,6 +183,11 @@ bLOCK_SIZE = BLOCK_SIZE
bLOCK_SIZE_W :: Int
bLOCK_SIZE_W = bLOCK_SIZE `quot` wORD_SIZE
+-- blocks that fit in an MBlock, leaving space for the block descriptors
+
+bLOCKS_PER_MBLOCK :: Int
+bLOCKS_PER_MBLOCK = BLOCKS_PER_MBLOCK
+
-- Number of bits to shift a bitfield left by in an info table.
bITMAP_BITS_SHIFT :: Int
diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index f0e514bbfc..ade104a4be 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -195,6 +195,8 @@ main(int argc, char *argv[])
printf("#define BLOCK_SIZE %u\n", BLOCK_SIZE);
printf("#define MBLOCK_SIZE %u\n", MBLOCK_SIZE);
+ printf("#define BLOCKS_PER_MBLOCK %lu\n", (lnat)BLOCKS_PER_MBLOCK);
+ // could be derived, but better to save doing the calculation twice
printf("\n\n");
#endif