1 /* -----------------------------------------------------------------------------
2 * $Id: Stg.h,v 1.32 2000/05/27 14:28:06 panne Exp $
4 * (c) The GHC Team, 1998-1999
6 * Top-level include file for everything STG-ish.
8 * This file is included *automatically* by all .hc files.
10 * ---------------------------------------------------------------------------*/
15 #ifndef NON_POSIX_SOURCE
16 #define _POSIX_SOURCE 1
17 #define _POSIX_C_SOURCE 199309L
18 #define _ISOC9X_SOURCE
21 /* Let's be ISO C9X too... */
23 /* If we include "Stg.h" directly, we're in STG code, and we therefore
24 * get all the global register variables, macros etc. that go along
25 * with that. If "Stg.h" is included via "Rts.h", we're assumed to
29 # define IN_STG_CODE 1
34 # define NO_REGS /* don't define fixed registers */
40 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
44 /* Some macros to handle DLLing (Win32 only at the moment). */
47 /* Turn lazy blackholing and eager blackholing on/off.
49 * Using eager blackholing makes things easier to debug because
50 * the blackholes are more predictable - but it's slower and less sexy.
52 * For now, do lazy and not eager.
55 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of
56 * single-entry thunks.
58 * SMP needs EAGER_BLACKHOLING because it has to lock thunks
59 * synchronously, in case another thread is trying to evaluate the
60 * same thunk simultaneously.
62 #if defined(SMP) || defined(TICKY_TICKY)
63 # define EAGER_BLACKHOLING
65 # define LAZY_BLACKHOLING
68 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
73 /* TABLES_NEXT_TO_CODE says whether to assume that info tables are
74 * assumed to reside just before the code for a function.
76 * UNDEFINING THIS WON'T WORK ON ITS OWN. You have been warned.
78 #ifndef USE_MINIINTERPRETER
79 #define TABLES_NEXT_TO_CODE
84 #define BITS_PER_BYTE 8
85 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
87 /* -----------------------------------------------------------------------------
88 Assertions and Debuggery
89 -------------------------------------------------------------------------- */
92 #define ASSERT(predicate) /* nothing */
95 void _stgAssert (char *, unsigned int);
97 #define ASSERT(predicate) \
101 _stgAssert(__FILE__, __LINE__)
104 /* -----------------------------------------------------------------------------
105 Include everything STG-ish
106 -------------------------------------------------------------------------- */
108 /* Global type definitions*/
109 #include "StgTypes.h"
110 #include "RtsTypes.h"
112 /* Global constaints */
113 #include "Constants.h"
115 /* Profiling information */
118 /* Storage format definitions */
119 #include "Closures.h"
120 #include "ClosureTypes.h"
121 #include "InfoTables.h"
124 /* Simulated-parallel information */
127 /* Parallel information */
128 #include "Parallel.h"
130 /* STG/Optimised-C related stuff */
132 #include "MachRegs.h"
134 #include "TailCalls.h"
137 /* RTS public interface */
140 /* these are all ANSI C headers */
163 /* Storage Manager */
164 #include "StgStorage.h"
166 /* Macros for STG/C code */
167 #include "ClosureMacros.h"
168 #include "InfoMacros.h"
169 #include "StgMacros.h"
172 #include "StgTicky.h"
176 /* Built-in entry points */
177 #include "StgMiscClosures.h"
179 /* Runtime-system hooks */
182 /* Misc stuff without a home */
183 DLL_IMPORT_RTS extern char **prog_argv; /* so we can get at these from Haskell */
184 DLL_IMPORT_RTS extern int prog_argc;
186 extern char **environ;
188 extern void stackOverflow(void);
190 /* Creating and destroying an adjustor thunk.
191 I cannot make myself create a separate .h file
195 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
196 extern void freeHaskellFunctionPtr(void* ptr);