[project @ 2005-04-21 15:28:20 by simonmar]
[ghc-hetmet.git] / ghc / compiler / codeGen / SMRep.lhs
index da446b6..b0b1b14 100644 (file)
@@ -28,7 +28,7 @@ module SMRep (
        SMRep(..), ClosureType(..),
        isStaticRep,
        fixedHdrSize, arrWordsHdrSize, arrPtrsHdrSize,
-       profHdrSize,
+       profHdrSize, thunkHdrSize,
        tablesNextToCode,
        smRepClosureType, smRepClosureTypeInt,
 
@@ -43,7 +43,7 @@ import Type           ( Type, typePrimRep, PrimRep(..) )
 import TyCon           ( TyCon, tyConPrimRep )
 import MachOp--                ( MachRep(..), MachHint(..), wordRep )
 import StaticFlags     ( opt_SccProfilingOn, opt_GranMacros,
-                         opt_Unregisterised )
+                         opt_Unregisterised, opt_SMP )
 import Constants
 import Outputable
 
@@ -285,6 +285,13 @@ arrWordsHdrSize   = fixedHdrSize*wORD_SIZE + sIZEOF_StgArrWords_NoHdr
 
 arrPtrsHdrSize    :: ByteOff
 arrPtrsHdrSize    = fixedHdrSize*wORD_SIZE + sIZEOF_StgMutArrPtrs_NoHdr
+
+-- Thunks have an extra header word on SMP, so the update doesn't 
+-- splat the payload.
+thunkHdrSize :: WordOff
+thunkHdrSize | opt_SMP          = fixedHdrSize + smp_hdr
+            | otherwise = fixedHdrSize
+       where smp_hdr = sIZEOF_StgSMPThunkHeader `quot` wORD_SIZE
 \end{code}
 
 \begin{code}