1 /* -----------------------------------------------------------------------------
2 * $Id: Stg.h,v 1.22 2000/01/13 14:34:01 hwloidl 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
19 /* If we include "Stg.h" directly, we're in STG code, and we therefore
20 * get all the global register variables, macros etc. that go along
21 * with that. If "Stg.h" is included via "Rts.h", we're assumed to
25 # define IN_STG_CODE 1
30 # define NO_REGS /* don't define fixed registers */
36 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
40 /* Some macros to handle DLLing (Win32 only at the moment). */
43 /* Turn lazy blackholing and eager blackholing on/off.
45 * Using eager blackholing makes things easier to debug because
46 * the blackholes are more predictable - but it's slower and less sexy.
48 * For now, do lazy and not eager.
51 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of
52 * single-entry thunks.
54 * SMP needs EAGER_BLACKHOLING because it has to lock thunks
55 * synchronously, in case another thread is trying to evaluate the
56 * same thunk simultaneously.
58 #if defined(SMP) || defined(TICKY_TICKY)
59 # define EAGER_BLACKHOLING
61 # define LAZY_BLACKHOLING
64 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
69 /* TABLES_NEXT_TO_CODE says whether to assume that info tables are
70 * assumed to reside just before the code for a function.
72 * UNDEFINING THIS WON'T WORK ON ITS OWN. You have been warned.
74 #ifndef USE_MINIINTERPRETER
75 #define TABLES_NEXT_TO_CODE
80 #define BITS_PER_BYTE 8
81 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
83 /* -----------------------------------------------------------------------------
84 Assertions and Debuggery
85 -------------------------------------------------------------------------- */
88 #define ASSERT(predicate) /* nothing */
91 void _stgAssert (char *, unsigned int);
93 #define ASSERT(predicate) \
97 _stgAssert(__FILE__, __LINE__)
100 /* -----------------------------------------------------------------------------
101 Include everything STG-ish
102 -------------------------------------------------------------------------- */
104 /* Global type definitions*/
105 #include "StgTypes.h"
106 #include "RtsTypes.h"
108 /* Global constaints */
109 #include "Constants.h"
111 /* Profiling information */
112 #include "Profiling.h"
114 /* Storage format definitions */
115 #include "Closures.h"
116 #include "ClosureTypes.h"
117 #include "InfoTables.h"
120 /* Simulated-parallel information */
123 /* Parallel information */
124 #include "Parallel.h"
126 /* STG/Optimised-C related stuff */
128 #include "MachRegs.h"
130 #include "TailCalls.h"
133 /* RTS public interface */
136 /* these are all ANSI C headers */
159 /* Wired-in Prelude identifiers */
162 /* Storage Manager */
163 #include "StgStorage.h"
165 /* Macros for STG/C code */
166 #include "ClosureMacros.h"
167 #include "InfoMacros.h"
168 #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 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
184 extern DLLIMPORT char **prog_argv; /* so we can get at these from Haskell */
185 extern DLLIMPORT int prog_argc;
187 extern char **prog_argv; /* so we can get at these from Haskell */
188 extern int prog_argc;
191 extern char **environ;
193 /* Creating and destroying an adjustor thunk.
194 I cannot make myself create a separate .h file
198 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
199 extern void freeHaskellFunctionPtr(void* ptr);