1 /* -----------------------------------------------------------------------------
2 * $Id: Stg.h,v 1.14 1999/06/25 09:14:54 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
21 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
25 /* Some macros to handle DLLing (Win32 only at the moment). */
28 /* Turn lazy blackholing and eager blackholing on/off.
30 * Using eager blackholing makes things easier to debug because
31 * the blackholes are more predictable - but it's slower and less sexy.
33 * For now, do lazy and not eager.
36 #define LAZY_BLACKHOLING
37 /* #define EAGER_BLACKHOLING */
40 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of single-entry thunks. */
41 # undef LAZY_BLACKHOLING
42 # define EAGER_BLACKHOLING
45 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
50 /* TABLES_NEXT_TO_CODE says whether to assume that info tables are
51 * assumed to reside just before the code for a function.
53 * UNDEFINING THIS WON'T WORK ON ITS OWN. You have been warned.
55 #ifndef USE_MINIINTERPRETER
56 #define TABLES_NEXT_TO_CODE
61 #define BITS_PER_BYTE 8
62 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
64 /* -----------------------------------------------------------------------------
65 Assertions and Debuggery
66 -------------------------------------------------------------------------- */
69 #define ASSERT(predicate) /* nothing */
72 void _stgAssert (char *, unsigned int);
74 #define ASSERT(predicate) \
78 _stgAssert(__FILE__, __LINE__)
81 /* -----------------------------------------------------------------------------
82 Include everything STG-ish
83 -------------------------------------------------------------------------- */
85 /* Global type definitions*/
88 /* Global constaints */
89 #include "Constants.h"
91 /* Profiling information */
92 #include "Profiling.h"
94 /* Storage format definitions */
96 #include "ClosureTypes.h"
97 #include "InfoTables.h"
100 /* STG/Optimised-C related stuff */
101 #include "MachRegs.h"
103 #include "TailCalls.h"
105 /* these are all ANSI C headers */
124 /* Wired-in Prelude identifiers */
127 /* Storage Manager */
128 #include "StgStorage.h"
130 /* Macros for STG/C code */
131 #include "ClosureMacros.h"
132 #include "InfoMacros.h"
133 #include "StgMacros.h"
137 #include "StgTicky.h"
141 /* Built-in entry points */
142 #include "StgMiscClosures.h"
144 /* Runtime-system hooks */
147 /* Misc stuff without a home */
148 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
149 extern DLLIMPORT char **prog_argv; /* so we can get at these from Haskell */
150 extern DLLIMPORT int prog_argc;
152 extern char **prog_argv; /* so we can get at these from Haskell */
153 extern int prog_argc;
156 extern char **environ;
158 /* Creating and destroying an adjustor thunk.
159 I cannot make myself create a separate .h file
163 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
164 extern void freeHaskellFunctionPtr(void* ptr);