e03ca1e9927c0b5a3d05b8f6ec9b8cf32963f52f
[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 #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 #if defined(PAR)
45 /* types only needed in the parallel system */
46 typedef struct hashtable ParHashTable;
47 typedef struct hashlist ParHashList;
48
49 // typedef double REAL_TIME;
50 // typedef W_ TIME;
51 // typedef GlobalTaskId Proc;
52 typedef int           GlobalTaskId;
53 typedef ullong        rtsTime;
54 typedef GlobalTaskId  PEs;
55 typedef unsigned int  rtsWeight;
56 typedef int           rtsPacket;
57 typedef int           OpCode;
58
59 /* Global addresses i.e. unique ids in a parallel setup; needed in Closures.h*/
60 typedef struct {
61   union {
62     StgPtr plc;
63     struct {
64       GlobalTaskId gtid;
65       int slot;
66     } gc;
67   } payload;
68   rtsWeight weight;
69 } globalAddr;
70
71 /* (GA, LA) pairs */
72 typedef struct gala {
73     globalAddr ga;
74     StgPtr la;
75     struct gala *next;
76     rtsBool preferred;
77 } GALA;
78
79 #elif defined(GRAN)
80
81 // GlobalTaskId is dummy in GranSim; 
82 // we define it to have cleaner code in the RTS
83 typedef int       GlobalTaskId;
84 typedef lnat      rtsTime;
85 typedef StgWord   PEs;
86
87 #endif
88
89 #endif /* RTS_TYPES_H */