[project @ 1999-07-06 09:19:47 by sof]
[ghc-hetmet.git] / ghc / includes / Stg.h
1 /* -----------------------------------------------------------------------------
2  * $Id: Stg.h,v 1.16 1999/07/06 09:19:47 sof Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * Top-level include file for everything STG-ish.  
7  *
8  * This file is included *automatically* by all .hc files.
9  *
10  * ---------------------------------------------------------------------------*/
11
12 #ifndef STG_H
13 #define STG_H
14
15 #ifndef NON_POSIX_SOURCE
16 #define _POSIX_SOURCE
17 #endif
18
19 /* Configuration */
20 #include "config.h"
21 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
22 #include "options.h"
23 #endif
24
25 /* Some macros to handle DLLing (Win32 only at the moment). */
26 #include "StgDLL.h"
27
28 /* Turn lazy blackholing and eager blackholing on/off.
29  *
30  * Using eager blackholing makes things easier to debug because
31  * the blackholes are more predictable - but it's slower and less sexy.
32  *
33  * For now, do lazy and not eager.
34  */
35
36 #define LAZY_BLACKHOLING
37 /* #define EAGER_BLACKHOLING */
38
39 #ifdef TICKY_TICKY
40 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of single-entry thunks. */
41 # undef  LAZY_BLACKHOLING 
42 # define EAGER_BLACKHOLING
43 #endif
44
45 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
46 #ifndef INTERPRETER
47 #define COMPILER 1
48 #endif
49
50 /* TABLES_NEXT_TO_CODE says whether to assume that info tables are
51  * assumed to reside just before the code for a function.
52  *
53  * UNDEFINING THIS WON'T WORK ON ITS OWN.  You have been warned.
54  */
55 #ifndef USE_MINIINTERPRETER
56 #define TABLES_NEXT_TO_CODE
57 #endif
58
59 /* bit macros
60  */
61 #define BITS_PER_BYTE 8
62 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
63
64 /* -----------------------------------------------------------------------------
65    Assertions and Debuggery
66    -------------------------------------------------------------------------- */
67
68 #ifndef DEBUG
69 #define ASSERT(predicate) /* nothing */
70 #else
71
72 void _stgAssert (char *, unsigned int);
73
74 #define ASSERT(predicate)                       \
75         if (predicate)                          \
76             /*null*/;                           \
77         else                                    \
78             _stgAssert(__FILE__, __LINE__)
79 #endif /* DEBUG */
80
81 /* -----------------------------------------------------------------------------
82    Include everything STG-ish
83    -------------------------------------------------------------------------- */
84
85 /* Global type definitions*/
86 #include "StgTypes.h"
87
88 /* Global constaints */
89 #include "Constants.h"
90
91 /* Profiling information */
92 #include "Profiling.h"
93
94 /* Storage format definitions */
95 #include "Closures.h"
96 #include "ClosureTypes.h"
97 #include "InfoTables.h"
98 #include "TSO.h"
99
100 /* STG/Optimised-C related stuff */
101 #include "MachRegs.h"
102 #include "Regs.h"
103 #include "TailCalls.h"
104
105 /* RTS public interface */
106 #ifndef COMPILING_RTS
107 #include "RtsAPI.h"
108 #endif
109
110 /* these are all ANSI C headers */
111 #include <stdlib.h>
112 #include <string.h>
113 #include <math.h>
114 #include <assert.h>
115 #include <errno.h>
116 #include <stdio.h>
117
118 #ifdef HAVE_SIGNAL_H
119 #include <signal.h>
120 #endif
121
122 #ifdef HAVE_UNISTD_H
123 #include <unistd.h>
124 #endif
125
126 /* GNU mp library */
127 #include "gmp.h"
128
129 /* Wired-in Prelude identifiers */
130 #include "Prelude.h"
131
132 /* Storage Manager */
133 #include "StgStorage.h"
134
135 /* Macros for STG/C code */
136 #include "ClosureMacros.h"
137 #include "InfoMacros.h"
138 #include "StgMacros.h"
139 #include "StgProf.h"
140 #include "PrimOps.h"
141 #include "Updates.h"
142 #include "StgTicky.h"
143 #include "CCall.h"
144 #include "Stable.h"
145
146 /* Built-in entry points */
147 #include "StgMiscClosures.h"
148
149 /* Runtime-system hooks */
150 #include "Hooks.h"
151
152 /* Misc stuff without a home */
153 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
154 extern DLLIMPORT char **prog_argv;      /* so we can get at these from Haskell */
155 extern DLLIMPORT int    prog_argc;
156 #else
157 extern char **prog_argv;        /* so we can get at these from Haskell */
158 extern int    prog_argc;
159 #endif
160
161 extern char **environ;
162
163 /* Creating and destroying an adjustor thunk.
164    I cannot make myself create a separate .h file
165    for these two (sof.) 
166    
167 */
168 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
169 extern void  freeHaskellFunctionPtr(void* ptr);
170
171 #endif /* STG_H */