summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
Diffstat (limited to 'ghc')
-rw-r--r--ghc/compiler/codeGen/CgProf.hs4
-rw-r--r--ghc/includes/StgProf.h15
2 files changed, 12 insertions, 7 deletions
diff --git a/ghc/compiler/codeGen/CgProf.hs b/ghc/compiler/codeGen/CgProf.hs
index 5177072bf6..844f1d75d2 100644
--- a/ghc/compiler/codeGen/CgProf.hs
+++ b/ghc/compiler/codeGen/CgProf.hs
@@ -316,12 +316,12 @@ emitCostCentreStackDecl ccs
mkCCostCentre cc,
zero, -- struct _CostCentreStack *prevStack;
zero, -- struct _IndexTable *indexTable;
- zero, -- StgWord selected;
zero64, -- StgWord64 scc_count;
+ zero, -- StgWord selected;
zero, -- StgWord time_ticks;
zero64, -- StgWord64 mem_alloc;
- zero, -- StgWord inherited_ticks;
zero64, -- StgWord64 inherited_alloc;
+ zero, -- StgWord inherited_ticks;
zero -- CostCentre *root;
]
; emitDataLits (mkCCSLabel ccs) lits
diff --git a/ghc/includes/StgProf.h b/ghc/includes/StgProf.h
index 82e552970e..b94066e20a 100644
--- a/ghc/includes/StgProf.h
+++ b/ghc/includes/StgProf.h
@@ -12,6 +12,12 @@
/* -----------------------------------------------------------------------------
* Data Structures
* ---------------------------------------------------------------------------*/
+// NB. be careful to avoid unwanted padding between fields, by
+// putting the 8-byte fields on an 8-byte boundary. Padding can
+// vary between C compilers, and we don't take into account any
+// possible padding when generating CCS and CC decls in the code
+// generator (compiler/codeGen/CgProf.hs).
+
typedef struct _CostCentre {
StgInt ccID;
@@ -20,14 +26,13 @@ typedef struct _CostCentre {
/* used for accumulating costs at the end of the run... */
StgWord time_ticks;
- StgWord64 mem_alloc;
+ StgWord64 mem_alloc; // align 8 (see above)
StgInt is_caf;
struct _CostCentre *link;
} CostCentre;
-
typedef struct _CostCentreStack {
StgInt ccsID;
@@ -35,12 +40,12 @@ typedef struct _CostCentreStack {
struct _CostCentreStack *prevStack;
struct _IndexTable *indexTable;
+ StgWord64 scc_count; // align 8 (see above)
StgWord selected;
- StgWord64 scc_count;
StgWord time_ticks;
- StgWord64 mem_alloc;
+ StgWord64 mem_alloc; // align 8 (see above)
+ StgWord64 inherited_alloc; // align 8 (see above)
StgWord inherited_ticks;
- StgWord64 inherited_alloc;
CostCentre *root;
} CostCentreStack;