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