summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-09-14 16:27:51 +0100
committerIan Lynagh <ian@well-typed.com>2012-09-14 16:27:51 +0100
commita22a9c217ec28e7ade94c589e894b87e144a7fed (patch)
tree43a22c92e82f931105b028019c65c90225a6f8d7 /compiler
parentb7dd4b5dbb658d7785f9a28c566be751173a2680 (diff)
downloadhaskell-a22a9c217ec28e7ade94c589e894b87e144a7fed.tar.gz
Move more constants to platformConstants
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/SMRep.lhs4
-rw-r--r--compiler/codeGen/CgForeignCall.hs2
-rw-r--r--compiler/codeGen/CgHeapery.lhs22
-rw-r--r--compiler/codeGen/StgCmmForeign.hs2
-rw-r--r--compiler/main/DynFlags.hs6
5 files changed, 19 insertions, 17 deletions
diff --git a/compiler/cmm/SMRep.lhs b/compiler/cmm/SMRep.lhs
index 95a5d38194..79e19105a9 100644
--- a/compiler/cmm/SMRep.lhs
+++ b/compiler/cmm/SMRep.lhs
@@ -219,13 +219,13 @@ isStaticNoCafCon _ = False
-- | Size of a closure header (StgHeader in includes/rts/storage/Closures.h)
fixedHdrSize :: DynFlags -> WordOff
-fixedHdrSize dflags = sTD_HDR_SIZE + profHdrSize dflags
+fixedHdrSize dflags = sTD_HDR_SIZE dflags + profHdrSize dflags
-- | Size of the profiling part of a closure header
-- (StgProfHeader in includes/rts/storage/Closures.h)
profHdrSize :: DynFlags -> WordOff
profHdrSize dflags
- | dopt Opt_SccProfilingOn dflags = pROF_HDR_SIZE
+ | dopt Opt_SccProfilingOn dflags = pROF_HDR_SIZE dflags
| otherwise = 0
-- | The garbage collector requires that every closure is at least as
diff --git a/compiler/codeGen/CgForeignCall.hs b/compiler/codeGen/CgForeignCall.hs
index 977c4e1583..0afa3c6915 100644
--- a/compiler/codeGen/CgForeignCall.hs
+++ b/compiler/codeGen/CgForeignCall.hs
@@ -267,7 +267,7 @@ emitOpenNursery =
(CmmMachOp (mo_wordMul dflags) [
CmmMachOp (MO_SS_Conv W32 (wordWidth dflags))
[CmmLoad (nursery_bdescr_blocks dflags) b32],
- mkIntExpr dflags bLOCK_SIZE
+ mkIntExpr dflags (bLOCK_SIZE dflags)
])
(-1)
)
diff --git a/compiler/codeGen/CgHeapery.lhs b/compiler/codeGen/CgHeapery.lhs
index e37783cf11..f3cb7796f4 100644
--- a/compiler/codeGen/CgHeapery.lhs
+++ b/compiler/codeGen/CgHeapery.lhs
@@ -452,20 +452,18 @@ do_checks :: WordOff -- Stack headroom
-> 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/4505",
- "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 live
= do dflags <- getDynFlags
- do_checks' (mkIntExpr dflags (stk*wORD_SIZE))
- (mkIntExpr dflags (hp*wORD_SIZE))
- (stk /= 0) (hp /= 0) reg_save_code rts_lbl live
+ if hp > bLOCKS_PER_MBLOCK dflags * bLOCK_SIZE_W dflags
+ then sorry (unlines [
+ "Trying to allocate more than " ++ show (bLOCKS_PER_MBLOCK dflags * bLOCK_SIZE dflags) ++ " bytes.",
+ "",
+ "See: http://hackage.haskell.org/trac/ghc/ticket/4505",
+ "Suggestion: read data from a file instead of having large static data",
+ "structures in the code."])
+ else do_checks' (mkIntExpr dflags (stk * wORD_SIZE))
+ (mkIntExpr dflags (hp * wORD_SIZE))
+ (stk /= 0) (hp /= 0) reg_save_code rts_lbl live
-- The offsets are now in *bytes*
do_checks' :: CmmExpr -> CmmExpr -> Bool -> Bool -> CmmStmts -> CmmExpr
diff --git a/compiler/codeGen/StgCmmForeign.hs b/compiler/codeGen/StgCmmForeign.hs
index 9523a11b1c..499c22b552 100644
--- a/compiler/codeGen/StgCmmForeign.hs
+++ b/compiler/codeGen/StgCmmForeign.hs
@@ -340,7 +340,7 @@ openNursery dflags = catAGraphs [
(CmmMachOp (mo_wordMul dflags) [
CmmMachOp (MO_SS_Conv W32 (wordWidth dflags))
[CmmLoad (nursery_bdescr_blocks dflags) b32],
- mkIntExpr dflags bLOCK_SIZE
+ mkIntExpr dflags (bLOCK_SIZE dflags)
])
(-1)
)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 15ef065d53..6cb99f87c7 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -118,6 +118,7 @@ module DynFlags (
tracingDynFlags,
#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellExports.hs"
+ bLOCK_SIZE_W,
) where
#include "HsVersions.h"
@@ -130,7 +131,7 @@ import {-# SOURCE #-} Packages (PackageState)
import DriverPhases ( Phase(..), phaseInputExt )
import Config
import CmdLineParser
-import Constants ( mAX_CONTEXT_REDUCTION_DEPTH )
+import Constants
import Panic
import Util
import Maybes ( orElse )
@@ -3145,3 +3146,6 @@ compilerInfo dflags
#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellType.hs"
#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellWrappers.hs"
+bLOCK_SIZE_W :: DynFlags -> Int
+bLOCK_SIZE_W dflags = bLOCK_SIZE dflags `quot` wORD_SIZE
+