[project @ 1999-06-25 09:13:37 by simonmar]
[ghc-hetmet.git] / ghc / includes / Stg.h
1 /* -----------------------------------------------------------------------------
2  * $Id: Stg.h,v 1.13 1999/06/25 09:13:38 simonmar Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * Top-level include file for everything STG-ish.  
7  *
8  * This file is included *automatically* by all .hc files.
9  *
10  * ---------------------------------------------------------------------------*/
11
12 #ifndef STG_H
13 #define STG_H
14
15 #ifndef NON_POSIX_SOURCE
16 #define _POSIX_SOURCE
17 #endif
18
19 /* Configuration */
20 #include "config.h"
21 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
22 #include "options.h"
23 #endif
24
25 /* Some macros to handle DLLing (Win32 only at the moment). */
26 #include "StgDLL.h"
27
28 /* Turn lazy blackholing and eager blackholing on/off.
29  *
30  * Using eager blackholing makes things easier to debug because
31  * the blackholes are more predictable - but it's slower and less sexy.
32  *
33  * For now, do lazy and not eager.
34  */
35
36 #define LAZY_BLACKHOLING
37 /* #define EAGER_BLACKHOLING */
38
39 #ifdef TICKY_TICKY
40 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of single-entry thunks. */
41 # undef  LAZY_BLACKHOLING 
42 # define EAGER_BLACKHOLING
43 #endif
44
45 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
46 #ifndef INTERPRETER
47 #define COMPILER 1
48 #endif
49
50 #ifndef USE_MINIINTERPRETER
51 #define TABLES_NEXT_TO_CODE
52 #endif
53
54 /* bit macros
55  */
56 #define BITS_PER_BYTE 8
57 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
58
59 /* -----------------------------------------------------------------------------
60    Assertions and Debuggery
61    -------------------------------------------------------------------------- */
62
63 #ifndef DEBUG
64 #define ASSERT(predicate) /* nothing */
65 #else
66
67 void _stgAssert (char *, unsigned int);
68
69 #define ASSERT(predicate)                       \
70         if (predicate)                          \
71             /*null*/;                           \
72         else                                    \
73             _stgAssert(__FILE__, __LINE__)
74 #endif /* DEBUG */
75
76 /* -----------------------------------------------------------------------------
77    Include everything STG-ish
78    -------------------------------------------------------------------------- */
79
80 /* Global type definitions*/
81 #include "StgTypes.h"
82
83 /* Global constaints */
84 #include "Constants.h"
85
86 /* Profiling information */
87 #include "Profiling.h"
88
89 /* Storage format definitions */
90 #include "Closures.h"
91 #include "ClosureTypes.h"
92 #include "InfoTables.h"
93 #include "TSO.h"
94
95 /* STG/Optimised-C related stuff */
96 #include "MachRegs.h"
97 #include "Regs.h"
98 #include "TailCalls.h"
99
100 /* these are all ANSI C headers */
101 #include <stdlib.h>
102 #include <string.h>
103 #include <math.h>
104 #include <assert.h>
105 #include <errno.h>
106 #include <stdio.h>
107
108 #ifdef HAVE_SIGNAL_H
109 #include <signal.h>
110 #endif
111
112 #ifdef HAVE_UNISTD_H
113 #include <unistd.h>
114 #endif
115
116 /* GNU mp library */
117 #include "gmp.h"
118
119 /* Wired-in Prelude identifiers */
120 #include "Prelude.h"
121
122 /* Storage Manager */
123 #include "StgStorage.h"
124
125 /* Macros for STG/C code */
126 #include "ClosureMacros.h"
127 #include "InfoMacros.h"
128 #include "StgMacros.h"
129 #include "StgProf.h"
130 #include "PrimOps.h"
131 #include "Updates.h"
132 #include "StgTicky.h"
133 #include "CCall.h"
134 #include "Stable.h"
135
136 /* Built-in entry points */
137 #include "StgMiscClosures.h"
138
139 /* Runtime-system hooks */
140 #include "Hooks.h"
141
142 /* Misc stuff without a home */
143 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
144 extern DLLIMPORT char **prog_argv;      /* so we can get at these from Haskell */
145 extern DLLIMPORT int    prog_argc;
146 #else
147 extern char **prog_argv;        /* so we can get at these from Haskell */
148 extern int    prog_argc;
149 #endif
150
151 extern char **environ;
152
153 /* Creating and destroying an adjustor thunk.
154    I cannot make myself create a separate .h file
155    for these two (sof.) 
156    
157 */
158 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
159 extern void  freeHaskellFunctionPtr(void* ptr);
160
161 #endif /* STG_H */