[project @ 2004-11-08 12:26:52 by simonmar]
[ghc-hetmet.git] / ghc / includes / RtsTypes.h
1 /*
2   Time-stamp: <2004-11-08 12:17:01 simonmar>
3
4   RTS specific types.
5 */
6
7 /* -------------------------------------------------------------------------
8    Generally useful typedefs
9    ------------------------------------------------------------------------- */
10
11 #ifndef RTS_TYPES_H
12 #define RTS_TYPES_H
13
14 #if SIZEOF_VOID_P == 8
15 typedef unsigned long nat;           /* at least 32 bits (like int) */
16 #else
17 typedef unsigned int  nat;           /* at least 32 bits (like int) */
18 #endif
19 typedef unsigned long lnat;          /* at least 32 bits            */
20 #ifndef _MSC_VER
21 typedef unsigned long long ullong;   /* at least 32 bits            */
22 typedef long long llong;
23 #else
24 typedef unsigned __int64   ullong;   /* at least 32 bits            */
25 typedef __int64 llong;
26 #endif
27
28 /* ullong (64|128-bit) type: only include if needed (not ANSI) */
29 #if defined(__GNUC__) 
30 #define LL(x) (x##LL)
31 #else
32 #define LL(x) (x##L)
33 #endif
34   
35 typedef enum { 
36     rtsFalse = 0, 
37     rtsTrue 
38 } rtsBool;
39
40 /* 
41    Types specific to the parallel runtime system.
42 */
43
44 typedef ullong        rtsTime;
45
46 #if defined(PAR)
47 /* types only needed in the parallel system */
48 typedef struct hashtable ParHashTable;
49 typedef struct hashlist ParHashList;
50
51 // typedef double REAL_TIME;
52 // typedef W_ TIME;
53 // typedef GlobalTaskId Proc;
54 typedef int           GlobalTaskId;
55 typedef GlobalTaskId  PEs;
56 typedef unsigned int  rtsWeight;
57 typedef int           rtsPacket;
58 typedef int           OpCode;
59
60 /* Global addresses i.e. unique ids in a parallel setup; needed in Closures.h*/
61 typedef struct {
62   union {
63     StgPtr plc;
64     struct {
65       GlobalTaskId gtid;
66       int slot;
67     } gc;
68   } payload;
69   rtsWeight weight;
70 } globalAddr;
71
72 /* (GA, LA) pairs */
73 typedef struct gala {
74     globalAddr ga;
75     StgPtr la;
76     struct gala *next;
77     rtsBool preferred;
78 } GALA;
79
80 #elif defined(GRAN)
81
82 // GlobalTaskId is dummy in GranSim; 
83 // we define it to have cleaner code in the RTS
84 typedef int       GlobalTaskId;
85 typedef lnat      rtsTime;
86 typedef StgWord   PEs;
87
88 #endif
89
90 #endif /* RTS_TYPES_H */