Commit 6a51f7df authored by simonmar's avatar simonmar
Browse files

[project @ 2005-03-18 11:19:27 by simonmar]

merge rev. 1.6.2.1, simplified slightly:

  Initialise a CostCentreStack by generating SIZEOF_CostCentreStack
  (gotten from the C compiler) zeros, padded to the nearest word.
  Improves on the previous fixes for unpredictable padding (see comment).
parent 5970d44a
...@@ -24,6 +24,8 @@ module CgProf ( ...@@ -24,6 +24,8 @@ module CgProf (
) where ) where
#include "HsVersions.h" #include "HsVersions.h"
#include "MachDeps.h"
-- For WORD_SIZE_IN_BITS only.
#include "../includes/Constants.h" #include "../includes/Constants.h"
-- For LDV_CREATE_MASK, LDV_STATE_USE -- For LDV_CREATE_MASK, LDV_STATE_USE
-- which are StgWords -- which are StgWords
...@@ -312,18 +314,13 @@ emitCostCentreStackDecl ...@@ -312,18 +314,13 @@ emitCostCentreStackDecl
emitCostCentreStackDecl ccs emitCostCentreStackDecl ccs
| Just cc <- maybeSingletonCCS ccs = do | Just cc <- maybeSingletonCCS ccs = do
{ let { let
lits = [ zero, -- Note: to avoid making any assumptions about how the
mkCCostCentre cc, -- C compiler (that compiles the RTS, in particular) does
zero, -- struct _CostCentreStack *prevStack; -- layouts of structs containing long-longs, simply
zero, -- struct _IndexTable *indexTable; -- pad out the struct with zero words until we hit the
zero64, -- StgWord64 scc_count; -- size of the overall struct (which we get via DerivedConstants.h)
zero, -- StgWord selected; --
zero, -- StgWord time_ticks; lits = zero : mkCCostCentre cc : replicate (sizeof_ccs_words - 2) zero
zero64, -- StgWord64 mem_alloc;
zero64, -- StgWord64 inherited_alloc;
zero, -- StgWord inherited_ticks;
zero -- CostCentre *root;
]
; emitDataLits (mkCCSLabel ccs) lits ; emitDataLits (mkCCSLabel ccs) lits
} }
| otherwise = pprPanic "emitCostCentreStackDecl" (ppr ccs) | otherwise = pprPanic "emitCostCentreStackDecl" (ppr ccs)
...@@ -331,6 +328,13 @@ emitCostCentreStackDecl ccs ...@@ -331,6 +328,13 @@ emitCostCentreStackDecl ccs
zero = mkIntCLit 0 zero = mkIntCLit 0
zero64 = CmmInt 0 I64 zero64 = CmmInt 0 I64
sizeof_ccs_words :: Int
sizeof_ccs_words
-- round up to the next word.
| ms == 0 = ws
| otherwise = ws + 1
where
(ws,ms) = SIZEOF_CostCentreStack `divMod` wORD_SIZE
-- --------------------------------------------------------------------------- -- ---------------------------------------------------------------------------
-- Registering CCs and CCSs -- Registering CCs and CCSs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment