Commit b8ced282 authored by simonmar's avatar simonmar
Browse files

[project @ 2005-03-17 12:45:08 by simonmar]

Rearrange the fields of CostCentreStack to leave no (or less) room for
arbitrary padding decisions by C compilers.
parent fdda641e
......@@ -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
......
......@@ -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;
......
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