1 /* -----------------------------------------------------------------------------
2 * $Id: Stg.h,v 1.20 1999/11/09 15:47:08 simonmar 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
26 # define NO_REGS /* don't define fixed registers */
29 # define IN_STG_CODE 1
34 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
38 /* Some macros to handle DLLing (Win32 only at the moment). */
41 /* Turn lazy blackholing and eager blackholing on/off.
43 * Using eager blackholing makes things easier to debug because
44 * the blackholes are more predictable - but it's slower and less sexy.
46 * For now, do lazy and not eager.
49 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of
50 * single-entry thunks.
52 * SMP needs EAGER_BLACKHOLING because it has to lock thunks
53 * synchronously, in case another thread is trying to evaluate the
54 * same thunk simultaneously.
56 #if defined(SMP) || defined(TICKY_TICKY)
57 # define EAGER_BLACKHOLING
59 # define LAZY_BLACKHOLING
62 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
67 /* TABLES_NEXT_TO_CODE says whether to assume that info tables are
68 * assumed to reside just before the code for a function.
70 * UNDEFINING THIS WON'T WORK ON ITS OWN. You have been warned.
72 #ifndef USE_MINIINTERPRETER
73 #define TABLES_NEXT_TO_CODE
78 #define BITS_PER_BYTE 8
79 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
81 /* -----------------------------------------------------------------------------
82 Assertions and Debuggery
83 -------------------------------------------------------------------------- */
86 #define ASSERT(predicate) /* nothing */
89 void _stgAssert (char *, unsigned int);
91 #define ASSERT(predicate) \
95 _stgAssert(__FILE__, __LINE__)
98 /* -----------------------------------------------------------------------------
99 Include everything STG-ish
100 -------------------------------------------------------------------------- */
102 /* Global type definitions*/
103 #include "StgTypes.h"
105 /* Global constaints */
106 #include "Constants.h"
108 /* Profiling information */
109 #include "Profiling.h"
111 /* Storage format definitions */
112 #include "Closures.h"
113 #include "ClosureTypes.h"
114 #include "InfoTables.h"
117 /* STG/Optimised-C related stuff */
119 #include "MachRegs.h"
121 #include "TailCalls.h"
124 /* RTS public interface */
127 /* these are all ANSI C headers */
150 /* Wired-in Prelude identifiers */
153 /* Storage Manager */
154 #include "StgStorage.h"
156 /* Macros for STG/C code */
157 #include "ClosureMacros.h"
158 #include "InfoMacros.h"
159 #include "StgMacros.h"
163 #include "StgTicky.h"
167 /* Built-in entry points */
168 #include "StgMiscClosures.h"
170 /* Runtime-system hooks */
173 /* Misc stuff without a home */
174 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
175 extern DLLIMPORT char **prog_argv; /* so we can get at these from Haskell */
176 extern DLLIMPORT int prog_argc;
178 extern char **prog_argv; /* so we can get at these from Haskell */
179 extern int prog_argc;
182 extern char **environ;
184 /* Creating and destroying an adjustor thunk.
185 I cannot make myself create a separate .h file
189 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
190 extern void freeHaskellFunctionPtr(void* ptr);