1 /* -----------------------------------------------------------------------------
2 * $Id: Stg.h,v 1.18 1999/11/02 15:05:52 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
24 #ifdef NOT_IN_STG_CODE
25 #define NO_REGS /* don't define fixed registers */
32 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
36 /* Some macros to handle DLLing (Win32 only at the moment). */
39 /* Turn lazy blackholing and eager blackholing on/off.
41 * Using eager blackholing makes things easier to debug because
42 * the blackholes are more predictable - but it's slower and less sexy.
44 * For now, do lazy and not eager.
47 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of
48 * single-entry thunks.
50 * SMP needs EAGER_BLACKHOLING because it has to lock thunks
51 * synchronously, in case another thread is trying to evaluate the
52 * same thunk simultaneously.
54 #if defined(SMP) || defined(TICKY_TICKY)
55 # define EAGER_BLACKHOLING
57 # define LAZY_BLACKHOLING
60 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
65 /* TABLES_NEXT_TO_CODE says whether to assume that info tables are
66 * assumed to reside just before the code for a function.
68 * UNDEFINING THIS WON'T WORK ON ITS OWN. You have been warned.
70 #ifndef USE_MINIINTERPRETER
71 #define TABLES_NEXT_TO_CODE
76 #define BITS_PER_BYTE 8
77 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
79 /* -----------------------------------------------------------------------------
80 Assertions and Debuggery
81 -------------------------------------------------------------------------- */
84 #define ASSERT(predicate) /* nothing */
87 void _stgAssert (char *, unsigned int);
89 #define ASSERT(predicate) \
93 _stgAssert(__FILE__, __LINE__)
96 /* -----------------------------------------------------------------------------
97 Include everything STG-ish
98 -------------------------------------------------------------------------- */
100 /* Global type definitions*/
101 #include "StgTypes.h"
103 /* Global constaints */
104 #include "Constants.h"
106 /* Profiling information */
107 #include "Profiling.h"
109 /* Storage format definitions */
110 #include "Closures.h"
111 #include "ClosureTypes.h"
112 #include "InfoTables.h"
116 /* STG/Optimised-C related stuff */
118 #include "MachRegs.h"
120 #include "TailCalls.h"
122 /* RTS public interface */
125 /* these are all ANSI C headers */
148 /* Wired-in Prelude identifiers */
151 /* Storage Manager */
152 #include "StgStorage.h"
154 /* Macros for STG/C code */
155 #include "ClosureMacros.h"
156 #include "InfoMacros.h"
157 #include "StgMacros.h"
161 #include "StgTicky.h"
165 /* Built-in entry points */
166 #include "StgMiscClosures.h"
168 /* Runtime-system hooks */
171 /* Misc stuff without a home */
172 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
173 extern DLLIMPORT char **prog_argv; /* so we can get at these from Haskell */
174 extern DLLIMPORT int prog_argc;
176 extern char **prog_argv; /* so we can get at these from Haskell */
177 extern int prog_argc;
180 extern char **environ;
182 /* Creating and destroying an adjustor thunk.
183 I cannot make myself create a separate .h file
187 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
188 extern void freeHaskellFunctionPtr(void* ptr);